rniemeyer / knockout-sortable

A Knockout.js binding to connect observableArrays with jQuery UI sortable functionality
MIT License
547 stars 128 forks source link

"items" sortable binding not refreshing on sort #115

Open birds-inc opened 9 years ago

birds-inc commented 9 years ago

Migrating our sortable interface and encountered this issue.

We use the .disabled class on our li's to make them not-selectable - this class is dynamically applied over the life of the list.

sortable: {
    data: list.listItems,
    options: {
        items: 'li:not(.disabled)'
    }

Sortable was able to handle this just fine. However, with knockout-sortable I have to use the cancel binding instead:

sortable: {
    data: list.listItems,
    options: {
        items: 'li',
        cancel: '.disabled',
    }

Calling .sortable("toArray") shows the list has been correctly updated, but knockout-sortable is preventing from the draggable behavior from being removed from the disabled items.