admin管理员组文章数量:1300013
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 e 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.
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 e 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.
Share Improve this question asked Nov 29, 2013 at 8:51 OktavOktav 2,1512 gold badges22 silver badges33 bronze badges 03 Answers
Reset to default 8The 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./sortable/
The stop event is the last to be fired. Check here to see all the events of a Jquery sortable element.
From the current source code, update
events are put into a queue:
delayedTriggers.push(function(event) {
this._trigger("update", event, this._uiHash());
}); //Trigger update callback if the DOM position has changed
The queued events are then triggered between beforestop
and stop
:
this._trigger("beforeStop", event, this._uiHash());
for (i=0; i < delayedTriggers.length; i++) {
delayedTriggers[i].call(this, event);
} //Trigger all delayed events
this._trigger("stop", event, this._uiHash());
Therefore, in the current implementation, update
events will always be triggered before stop
events.
本文标签: javascriptjQuery UI Sortable order of eventsStack Overflow
版权声明:本文标题:javascript - jQuery UI Sortable: order of events - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741642057a2389975.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论