0

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 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

That was pretty much it, I'm using require JS and I didn't notice I was manually including the jqueryUI plugin pieces. Sortable was not included.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.