You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dragging an element from one list to a second list, the Store "set" callback is called of the originating list, but not on the receiving list. This results in a the "order" array of the receiving list not being updated, so you don't have an accurate variable with the most current order. (as soon as you move items withing that "receiving" list, the order will be updated. But if you use the order variable without moving something, it will be incorrect.
I was able to overcome this by adding an "onAdd" callback in the Sortable setup:
onAdd: function (evt) {
orderq.splice(evt.newIndex, 0, evt.item.getAttribute("data-id"));
},
Perhaps this is the intended design or I'm using this library incorrectly, so I wouldn't necessarily call this a bug.
Also, I should note that it is important to initialize the "order" arrays properly, otherwise they start as undefined. For example, include the "get" callback function below:
Lastly, it seems a bit overkill that I return the "order" array in the get function since it is just setting the order to the current order. I can remove the "return" statement and everything will work. But I do get one error in the console: "TypeError: order is undefined" at line 1057 of Sortable.js. I've submitted a pull request to fix this.
The text was updated successfully, but these errors were encountered:
When dragging an element from one list to a second list, the Store "set" callback is called of the originating list, but not on the receiving list. This results in a the "order" array of the receiving list not being updated, so you don't have an accurate variable with the most current order. (as soon as you move items withing that "receiving" list, the order will be updated. But if you use the order variable without moving something, it will be incorrect.
I was able to overcome this by adding an "onAdd" callback in the Sortable setup:
Here is my jsbin.
Perhaps this is the intended design or I'm using this library incorrectly, so I wouldn't necessarily call this a bug.
Also, I should note that it is important to initialize the "order" arrays properly, otherwise they start as undefined. For example, include the "get" callback function below:
Lastly, it seems a bit overkill that I return the "order" array in the get function since it is just setting the order to the current order. I can remove the "return" statement and everything will work. But I do get one error in the console: "TypeError: order is undefined" at line 1057 of Sortable.js. I've submitted a pull request to fix this.
The text was updated successfully, but these errors were encountered: