Custom delete button not working in mobile devices.
xtreemMobile opened this issue · comments
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:
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
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;
}
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!