Browse Source

Merge pull request #562 from fendy3002/patch-1

knockout-sortable Remove dom element reference to viemodel and use local variable instead
pull/564/head
Lebedev Konstantin 9 years ago
parent
commit
23bc3b79f2
  1. 4
      knockout-sortable.js

4
knockout-sortable.js

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

Loading…
Cancel
Save