Reputation: 5651
I'm adding a sortable element on a table, it's a new requirement right at the end of the project so I don't feel I have the time to learn and add the knockout-sortable plugin. I tried adding a binding handler with a simple call to the element using jqueryui to make it sortable but ran into an error:
Object [object Object] has no method 'sortable'
The binding handler is really simple:
ko.bindingHandlers.sortItems = {
init: function () {
$('#itemGroup').sortable();
}
};
and the table is a table with a data-bind: foreach, looping through an array of items:
<tbody id="itemGroup" data-bind="foreach: itemDetails, sortItems: {}">
Any idea where I could be going wrong here?
Upvotes: 0
Views: 128
Reputation: 425
It seems sortable plugin is not loaded when you call it. Check order of tags.
Upvotes: 2