SortableJS / Sortable

Reorderable drag-and-drop lists for modern browsers and touch devices. No jQuery or framework required.
https://sortablejs.github.io/Sortable/
MIT License
29.72k stars 3.7k forks source link

Updating the order when adding an li #2013

Closed ArvidAnderson closed 3 years ago

ArvidAnderson commented 3 years ago

Updating the order when adding an li Hello, im pretty new to javascript overall and just found this amazing library which i have now included to my electron app. Everything works great except that it dosen't update the order when im appending an li to my ul unless i move the position. Ive read the documentation a few times and tried most of the things but none of them seem to be registering my new li that i appended to the the ul using javascript.

Im only using javascript and not trying to get jquery involved at the moment, ive alredy been on google and can't seem to find any soulutions on there.

All help is highly appreciated. The simple question rules, how do i update sortable js to register my new li

ArvidAnderson commented 3 years ago

Found out a soulution, running these again is working! order = store.get(sortable.options.group.name); order ? order.split('|') : []; order = sortable.toArray(); store.set(sortable.options.group.name, order.join('|'));