JQuery Draggable + Sortable:如何判断项目是否实际添加到我的可排序列表? [英] JQuery Draggable + Sortable: How to tell if item was actually added to my sortable list?
问题描述
我可以从我的可拖动列表中拖动项目,并将其放在我的可排序列表中。这样可以正常工作。
只有当这些项目中的一个被删除到可排序的时候,我才需要点击 。
我已经尝试了可拖动项目上的停止钩子,但是无论项目何时丢失都会触发(如果还原:触发无效 , 例如)。我找不到任何属性来告诉我拖拽是否成功。
我已经尝试将可排序方式视为可卸载,并绑定到
感谢您的帮助!
找到它!
可排序有一个名为receive的事件。 http://api.jqueryui.com/sortable/#event-receive
在过去几个小时的挖掘中,我错过了这个超出我的水平。
OK, I'm probably missing something obvious here, but my searches aren't turning up anything helpful. I've set up a sortable list and connected a draggable "palette list" to it, as explained here: http://jqueryui.com/demos/draggable/#sortable
I can drag items from my draggable list and drop them on my sortable list. That works fine.
I need to fire a function only when one of these items is dropped onto the sortable.
I've tried the "stop" hook on the draggable item, but that fires regardless of where the item is dropped (it fires if revert: 'invalid' is triggered, for example). I can't find any properties anywhere to tell me whether the drag was successful or not.
I've tried treating the sortable as a "droppable" and binding to "drop", but that doesn't even get called.
Thanks for the help!
Found it!
Sortable has an event called receive. http://api.jqueryui.com/sortable/#event-receive
How I missed this in the past few hours of digging is beyond me.
这篇关于JQuery Draggable + Sortable:如何判断项目是否实际添加到我的可排序列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!