Browse Source

Ran grunt after adding knockoutjs bindinghandlers

pull/297/head
srosengren 10 years ago
parent
commit
2920836d5c
  1. 2
      Sortable.min.js
  2. 13
      knockout-sortable.js

2
Sortable.min.js vendored

File diff suppressed because one or more lines are too long

13
knockout-sortable.js

@ -1,6 +1,8 @@
(function () { (function () {
"use strict";
var init = function (element, valueAccessor, allBindings, viewModel, bindingContext, sortableOptions) { var init = function (element, valueAccessor, allBindings, viewModel, bindingContext, sortableOptions) {
var options = buildOptions(valueAccessor, sortableOptions); var options = buildOptions(valueAccessor, sortableOptions);
//It's seems that we cannot update the eventhandlers after we've created the sortable, so define them in init instead of update //It's seems that we cannot update the eventhandlers after we've created the sortable, so define them in init instead of update
@ -27,14 +29,14 @@
ko.utils.domNodeDisposal.addDisposeCallback(element, function () { ko.utils.domNodeDisposal.addDisposeCallback(element, function () {
viewModel._sortable.destroy(); viewModel._sortable.destroy();
}); });
return ko.bindingHandlers['template']['init'](element, valueAccessor); return ko.bindingHandlers.template.init(element, valueAccessor);
}, },
update = function (element, valueAccessor, allBindings, viewModel, bindingContext, sortableOptions) { update = function (element, valueAccessor, allBindings, viewModel, bindingContext, sortableOptions) {
//There seems to be some problems with updating the options of a sortable //There seems to be some problems with updating the options of a sortable
//Tested to change eventhandlers and the group options without any luck //Tested to change eventhandlers and the group options without any luck
return ko.bindingHandlers['template']['update'](element, valueAccessor, allBindings, viewModel, bindingContext); return ko.bindingHandlers.template.update(element, valueAccessor, allBindings, viewModel, bindingContext);
}, },
eventHandlers = (function (handlers) { eventHandlers = (function (handlers) {
@ -93,7 +95,7 @@
handlers.onUpdate = function (e, itemVM, parentVM, collection, parentBindings) { handlers.onUpdate = function (e, itemVM, parentVM, collection, parentBindings) {
//This will be performed as a sort since the to/from collections reference the same collection and clone is set to false //This will be performed as a sort since the to/from collections reference the same collection and clone is set to false
moveItem(itemVM, collection, collection, false, e); moveItem(itemVM, collection, collection, false, e);
} };
return handlers; return handlers;
})({}), })({}),
@ -116,7 +118,8 @@
return into; return into;
}, },
//unwrap the supplied options //unwrap the supplied options
unwrappedOptions = ko.utils.peekObservable(bindingOptions()).options || {}, unwrappedOptions = ko.utils.peekObservable(bindingOptions()).options || {};
//Make sure that we don't modify the provided settings object //Make sure that we don't modify the provided settings object
options = merge({}, options); options = merge({}, options);
@ -153,6 +156,6 @@
update: function (element, valueAccessor, allBindings, viewModel, bindingContext) { update: function (element, valueAccessor, allBindings, viewModel, bindingContext) {
return update(element, valueAccessor, allBindings, viewModel, bindingContext, ko.bindingHandlers.sortable.sortableOptions); return update(element, valueAccessor, allBindings, viewModel, bindingContext, ko.bindingHandlers.sortable.sortableOptions);
} }
} };
})(); })();
Loading…
Cancel
Save