FIX : New index count is calculating wrong.#207
Conversation
When we change the index of an element in sortable list to forward ( ex : 0 to 4 ) it always turns newIndex+1 ( ex : 5 instead of 4 ) but it works good when we move to backward in list. So if we check newIndex>startIndex then decrease the nexIndex -1 it gives right result.
|
I've never seen this problem at http://rubaxa-sortable.meteor.com/ (see the console - it displays the indices of the element after reordering) |
|
Thats interesting after i change the structure of Sorry for bothering all of you. |
|
I managed to create situation again. It is only happening pull option set to 'clone'; |
|
A test case on JSBin would be good. We don't have automatic testing yet, but when we'll implement that, it would help to import all the test cases that people have filed. |
|
Here is the jsBin example : http://jsbin.com/dotiyokuqi/2/edit?html,css,js,console,output Move first element 3th line. You should see oldIndex :0 newIndex :2, but you will get oldIndex :0 newIndex :3. |
|
Try dev-branch: https://github.com/RubaXa/Sortable/blob/dev/Sortable.js#L628-L632 |
When we change the index of an element in sortable list to forward ( ex : 0 to 4 ) it always turns newIndex+1 ( ex : 5 instead of 4 ) but it works good when we move to backward in list. So if we check newIndex>startIndex then decrease the nexIndex -1 it gives right result.