Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom delete button not working in mobile devices. #213

Open
xtreemMobile opened this issue Nov 10, 2020 · 2 comments
Open

Custom delete button not working in mobile devices. #213

xtreemMobile opened this issue Nov 10, 2020 · 2 comments

Comments

@xtreemMobile
Copy link

xtreemMobile commented Nov 10, 2020

Hello,

Greetings!!

I'm using the ngx-sortablejs for change the position of the elements. I have added the custom delete button for remove the particular element.

I'm using the following code:

  • images Modify
    order

removeImage(i, id) {
// delete element code goes here
}

The above code is working fine in the Desktop and some mobile devices. But in the another mobile device's, it's not working. On the click on item, the drag feature enabled instead of delete function.

Could you please help me out for solve the problem?

Thanks In Advance

@RemcovandenBerg
Copy link

RemcovandenBerg commented Jan 5, 2022

Try excluding your delete button by using the filter:

  private filterSortable(event: PointerEvent): boolean {
    // using closest to find if there is a parent with class, target often is svg-element
    const isRemoveIcon = (event.target as HTMLElement).closest('.remove-icon-box');
    return !this.editModeActive || !!isRemoveIcon;
  }

@abcdleandro
Copy link

I had the same problem, I just disabled drag action in element, check the doc.

filter: ".ignore-elements", // Selectors that do not lead to dragging (String or Function)

Work for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants