kutlugsahin / smooth-dnd

drag and drop library for javascript
MIT License
599 stars 147 forks source link

Select element for the draggable wrapper #24

Open skoulix opened 5 years ago

skoulix commented 5 years ago

We can select the container element during initialization. Is there any way that I can select which element is going to be the draggable wrapper.

The reason for asking this is because I'm trying to make the plugin work with table rows. I can select the tbody as the container but after initialization the plugin inserts an additional div for the draggable element, after the tbody and before the tr element and the tables breaks, as expected.

Thanks for this great plugin.

juanrisso commented 5 years ago

Could you fix this? I've solved this by using the Draggable's render method.

SarthakSri98 commented 4 years ago

@juanrisso can you please explain a little bit how did you solve the issue? In my case I too want to modify the wrapper. At this time I am overriding the parent element(i.e. wrapper element provided by the library) of draggable by my own wrapper in the onDrop function but when I drag and drop really fast, it breaks the code.

juanrisso commented 4 years ago

@SarthakSri98 Some time ago we switched the library to react-list-drag-and-drop because of that problem. Sorry, I cant help you

skoulix commented 4 years ago

Same here, I ended up using another library for the reason that I'm describing in my initial post.

SarthakSri98 commented 4 years ago

@skoulix okay, can you please tell me what library you used?

skoulix commented 4 years ago

@skoulix okay, can you please tell me what library you used?

So many libraries out there... When I posted this comment 2 years ago I was working on a specific project. For that project I used this one https://sortablejs.github.io/Vue.Draggable since it was a Vue.js project. Also another feature rich library I stumbled upon is this one https://shopify.github.io/draggable/

I hope this helps.