-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get newIndex during onMove
#1323
Comments
@schwamic If I understand you problem correctly you want to show the current index onMove. Check out this. |
Yep, I do have the same thing going on here. I use SortableJs to sort a list of canvas elements (1 element is up to the front, 2nd behind, etc...). When I drag element on my list i'd like to have the instant update/change on my canvas but I currently have to wait until "onUpdate", "onSort", or "onEnd" to trigger. There is still no way to fetch the current order with the "onMove" event ? |
@antoine-nedelec Hang tight and it will be in the next version. If you really need it now, you can use |
Thanks that would be great :), but I couldn't find a way to use: Would you have a working example with this ? |
@antoine-nedelec Use it in the |
@antoine-nedelec 1.8.0 is published. |
Awesome it works perfectly, thanks. If anyone needs it, the sorted list is under "evt.target.childNodes" |
In the current version there is no easy way to get the current order of the list during onMove. Neither the 'ghost'-element nor an exact position of the 'drag'-element can be identified. However, there must be an exact order within Sortable, why is this information not accessible? It would be a nice feature for a better UX, if the index of the list-items would be updated during onMove instead of onEnd.
I have already tested the following:
The index returned is not consistent and therefore cannot be used easily. Often the index by one or two positions does not match the current list. Also the 'toArray' does not give any clear information about the current order of the elements while onMove, and is difficult to find out how the indexes have to be mapped.
Is there currently still another way to get the current order during onMove?
The text was updated successfully, but these errors were encountered: