Getting all elements positions
lmatheus opened this issue · comments
Is there a way of knowing the index of all the draggable elements?
The only thing I have found is the current "order changed" or "item moved" element by using the event.dest.index (and this is relative to the parent). Haven't found a way of getting all of the elements indexes at once.
The intention is to save this positions on the database so I can retain their position when it changes.
Hi @lmatheus,
You can get it each time you move an element. Thats what i do:
orderChanged: function (event) {
//Mapped because i only need ID
var tasks = event.source.sortableScope.modelValue.map(function(a) {return a.id;});;
//Update tasks with new positions
console.log(tasks);
ctrl.updateSort(tasks);
}