简体   繁体   中英

Drag and drop nested list with stimulus and Rails

I need to do a draggable (drag and drop) nested list with use of stimulus + RoR.

Expected behaviour: When user drops an item (item A) inside another one (Item B) - Item B should became parent item for Item A. Any tips how to approach this?

you can do this with sortable js.

There is also a ready-made Stimulus controller in Stimulus Components that you could get inspiration from.

https://github.com/SortableJS/Sortable

https://www.stimulus-components.com/docs/stimulus-sortable

https://github.com/stimulus-components/stimulus-sortable/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM