0
votes

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?

1

1 Answers

1
votes

It seems sortable plugin is not loaded when you call it. Check order of tags.