Closed p32929 closed 2 years ago
Thanks for the kind words!
The issue in your example comes from the fact that the onSortEnd
callback gives you the indexes of the items that changed in the "filtered" list (the one that is passed to the SortableList
but you apply the change using these indexes on the original non-filtered array.
I see 2 possible solutions:
Hi, thanks a lot for the amazing explanation.
Pardon my ignorance, but I think, the explanation only explains why A becomes B while rearranging. but doesn't explain why G & I doesn't rearrange.
When switching G and I, you can see that E becomes D. This is because G and I are indexes 3 and 4 in the filtered array: when inverting these indexes in the original array, you actually switch D and E. That's why you see D becoming E. 🙂
Awesome. Thanks a lot for the explanation. Have a wonderful day...
Hello, first of all, thanks for making/maintaining this amazing library.
Describe the bug Showing weird behavior if a filtered list is used to rerrange
To Reproduce
Here's a gif with a demo of the issue explained above:![res](https://user-images.githubusercontent.com/6418354/183491950-d5b680aa-5ca6-430d-b229-f95d3abd27a6.gif)
Expected behavior The rearranged list should work properly/correctly