JQuery Draggable + Sortable:如何判断项目是否实际添加到我的可排序列表? [英] JQuery Draggable + Sortable: How to tell if item was actually added to my sortable list?

查看:216
本文介绍了JQuery Draggable + Sortable:如何判断项目是否实际添加到我的可排序列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,我可能在这里忘记了一些明显的东西,但是我的搜索没有什么帮助。我已经设置了一个可排序的列表,并将可调用的调色板列表连接到它,如下所述: http://jqueryui.com/demos/draggable/#sortable



我可以从我的可拖动列表中拖动项目,并将其放在我的可排序列表中。这样可以正常工作。



只有当这些项目中的一个被删除到可排序的时候,我才需要点击



我已经尝试了可拖动项目上的停止钩子,但是无论项目何时丢失都会触发(如果还原:触发无效 , 例如)。我找不到任何属性来告诉我拖拽是否成功。



我已经尝试将可排序方式视为可卸载,并绑定到



感谢您的帮助!

解决方案

找到它!



可排序有一个名为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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆