开发者

JQuery Draggable + Sortable: How to tell if item was actually added to my sortable list?

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 开发者_如何学Pythononly 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜