Browse Source

Update knockout-sortable.js

Use closure local variable instead of attaching the element to viewmodel. This is to prevent error caused by bound dom element as in issue 559.
https://github.com/RubaXa/Sortable/issues/559
pull/560/head
fendy3002 9 years ago
parent
commit
70d04f9346
  1. 4
      knockout-sortable.js

4
knockout-sortable.js

@ -36,11 +36,11 @@
}.bind(undefined, e, viewModel, allBindings, options[e]);
});
viewModel._sortable = Sortable.create(element, options);
sortableElement = Sortable.create(element, options);
//Destroy the sortable if knockout disposes the element it's connected to
ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
viewModel._sortable.destroy();
sortableElement.destroy();
});
return ko.bindingHandlers.template.init(element, valueAccessor);
},

Loading…
Cancel
Save