Disabling drag and drop features post v3.0.3, keeping selection #222
-
Hey, i've read https://dragselect.com/docs/API/Overrides and #204 As far as i know, the proper way to toggle of the dragging feature on selectable elements (which is default on), is by overriding Drag.filterDragElements, so i tried the following on my Next 14.2 code after following the React setup guide: // @ts-ignore: Accessing private property
const dragInstance = ds.Drag
if (dragInstance) {
dragInstance.filterDragElements = () => false // optionally tried to return an empty array
} I may be dumb but the main idea is to filter everything out so that no item is, in fact, draggable. The result i obtain is that i can still drag my items arround for the best case (where i let the filter untouched and return all items), whereas in worst case scenario i can drag once, and every drag of the item after that cause an error of "Cannot read properties of undefined (reading 'forEach')") I tried bunch of workarround solutions aside, like subscribing an empty callback on DS:start, setting the html "draggable" atribute to false on all my items components, disabling user-select on css properties etc, but nothing worked yet Thanks for the tool, it's great, tho help would be very appreciated Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @TheoXsp thanks for using the tool! ❤️ |
Beta Was this translation helpful? Give feedback.
Hi @TheoXsp thanks for using the tool! ❤️
If you just want to turn off the dragging functionality, why not set
draggability
tofalse
(see docs). Is that what you mean? :)(I think the description should be updated to be clearer: "turns the drag and drop functionality off")