thisbeyond / solid-dnd

A lightweight, performant, extensible drag and drop toolkit for Solid JS.
https://solid-dnd.com
MIT License
516 stars 34 forks source link

Trying to render a custom component as sortable #99

Closed ZanzyTHEbar closed 1 year ago

ZanzyTHEbar commented 1 year ago

I want to like this library, so far it seems well-built and i love the solid forward approach.

I am trying to render a vertically sortable list of custom components, and i am having trouble. Perhaps someone could help me see my issue.

Here is a gist of my current code

I am trying to render the TriggerComponent N number of times (based onthe number of objects in the store), and pass it the values from my store, and make each rendered instance draggable. However, my current attempt is only dragging the id member of the store object and i cant seem to get the component itself to drag properly.

Its late, I've been staring at this for awhile, and its probably something obvious. Any help would be appreciated.

martinpengellyphillips commented 1 year ago

As you are using the overlay component, you need to manage rendering what you want to see as the active drag component. This can be any component, but must not create a new draggable (e.g. Presentation only). In your case it means you want to render the trigger component as a child of the overlay (but not call create draggable for that instance).

ZanzyTHEbar commented 1 year ago

That makes sense, thank you - ill give it a go.

martinpengellyphillips commented 1 year ago

Did it work? If so, please close this issue.

ZanzyTHEbar commented 1 year ago

i moved on to a different library, this one did was far too obtuse to use. Will come back when this has proper docs and more active development. Would be a great library though, if so.