Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI Sortable: order of events

Does anyone know in which order the jQuery sortable events are being triggered? I'm asking this because I had a problem with stop and update. It made more sense to me that update event would come after stop event but that was not the case.

Is this documented anywhere or did someone investigate this? I couldn't manage to find a proper list and I don't feel like looking through the code just yet.

like image 572
Oktav Avatar asked Oct 24 '25 06:10

Oktav


1 Answers

The order of events is:

create - Triggered when the sortable is created

start - Triggered when sorting starts

activate - Triggered for every connected list on drag start

over - Triggered when a sortable item is moved into a sortable list

sort - Triggered during sorting

change - Triggered during sorting, but only when DOM position has changed

beforeStop - Triggered before sorting stops, placeholder/helper

update - Triggered when stopped sorting and DOM position has changed

deactivate - Triggered before sorting stopped, propagated to all possible connected lists

out - Triggered when a sortable item is moved away from a sortable list

stop - Triggered when sorting has stopped

There are other events which can occur too:

receive/remove - Triggered when items are moved between lists

No idea why this isn't clearer on the jQueryUI site.

Note that, depending upon the event triggered, the ui arguments differs. It's worth looking at the API documentation to be clear what this is and to debug it.

http://api.jqueryui.com/sortable/

like image 57
omarjebari Avatar answered Oct 26 '25 19:10

omarjebari