knockout-sortable
knockout-sortable copied to clipboard
Confirmation popup before aftermove is executed
trafficstars
Hi I have this piece of code
<div class="query-result" data-bind="onWindowResize: 218">
<ul class="nav nav-pills nav-stacked" data-bind="sortable: { template: 'query-result-item-template', aftermove: reorder, data: $page.child('read')().children }">
</ul>
</div>
Its a list, and everytime you move each item a function reorder is executed.
My question is it possible to add a confirmation popup before the reorder function is executed? I want to warn the user about the action he is going to perform.
You can use the beforeMove handler and set arg.cancelDrop to true if the user wishes to cancel the move.
ko.bindingHandlers.sortable.afterMove = function (arg, event, ui) {
//show popup, get user response, set arg.cancelDrop accordingly
}