$watch vs stop() callback run sequence
insmark opened this issue · 9 comments
I try to convert this connected list to the multiselection list. When I select multiple items from right to left, it doesn't work at all, not sure if I did wrong or there is bug.
That's interesting... It seems right... I will investigate it.
The issue seems to be that the $watch
runs before the stop
callback, where the multi-item-selection actually moves the models from one list to an other. Here is a working sample-pen.
Feel free to re-open in any case.
Hi, thank you very much for the quick fix. I have another question. I add a button to find all the selected items from the left, then add to the right instead of drag and drop. How can I find all the selected items?
Here is a working codepen sample.
Alternatively, you can listen for the ui-sortable-selectionschanged
event one the parent element.
Thank you!
Hi, your codepen sample works find in Chrome and Firefox, but in IE11 got SCRIPT1002: Syntax error for the line "var selectedItems = $('.availableReportsBox .ui-sortable-selected').toArray().map(x => $(x).scope().listItem);", looks like the IE doesn't like the "=>".
I don't even remember using it... But it obviously got in there anyway. I guess you can easily change the arrow function expression to a plain anonymous function yourself function(x){...}
.
It works fine change to "var selectedItems = $('.availableReportsBox .ui-sortable-selected').toArray().map(function (x) { return $(x).scope().listItem });", thanks.