rniemeyer / knockout-sortable

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

Sortable not working after upgrading to knockout 3.5 #198

Closed sanderevers84 closed 4 years ago

sanderevers84 commented 5 years ago

After upgrading to KnockoutJS version 3.5.0, the sortable plugin stopped working.

koproblem

After adding an element to the array the element appears twice, when removing the element both elemenst are removed. Readding the same element and it will show three elements. This increases every time by one.

The shown JS error is thrown after removing one of the elements.

JasperTey commented 5 years ago

I also just noticed this, and had to downgrade to Knockout 3.4.2 in the meantime. Subscribing for notifications on the progress of this issue.

rniemeyer commented 5 years ago

@sanderevers84 @JasperTey - I am taking a look at this issue. Just to ensure that I am reproducing the same issue, can either of you verify taht with 3.5.0, it works fine if you use binding syntax like sortable: { data: tasks } rather than sortable: tasks.

rniemeyer commented 5 years ago

I have a branch with a fix that you can try: https://github.com/rniemeyer/knockout-sortable/blob/defect-with-ko-3-5-0/build/knockout-sortable.min.js. I want to do some additional testing before moving into master and would love to hear that it does solve your issues.

sanderevers84 commented 5 years ago

@rniemeyer Both using the sortable: { data: task } syntax and your fix solved my issue. Thanks.

JasperTey commented 5 years ago

use binding syntax like sortable: { data: tasks } rather than sortable: tasks.

Yup, confirmed working on my end too after switching to this syntax.

I have a branch with a fix that you can try: https://github.com/rniemeyer/knockout-sortable/blob/defect-with-ko-3-5-0/build/knockout-sortable.min.js.

Yup, this fix solves it entirely, for both syntax cases.

dove commented 5 years ago

I can confirm that sortable is working for me after upgrading to 3.5 (I already had {sortable: {data: task} binding

JasperTey commented 4 years ago

What's the status on moving the fix into master?

rniemeyer commented 4 years ago

Version 1.2.0 is out now with compatibility fixes for KO 3.5.0 and 3.5.1. Thanks. Sorry for the delay. I have no excuse :)

SZaraqKhanA commented 3 years ago

I am still facing the following issues after re doing all the steps mentioned above:

rniemeyer commented 3 years ago

@SZaraqKhanA - do you have a some kind of sample that I might be able to look at?