简体   繁体   English

jQuery可排序替换而不是追加?

[英]jQuery sortable replace instead of append?

Hey guys was just wondering if there was anyway to replace a list item instead of appending it from a connected list, then putting the replaced item in the connected list the draged item came from? 大家只是想知道是否有替换列表项的方法,而不是从连接的列表中追加列表项,然后将替换的项目放在拖动的项来自的连接列表中吗? is jquery sortable capable of this any help would be greatly appriciated! 是jQuery可排序的能力,任何帮助将不胜枚举! Thanks 谢谢

What is the effect you are trying to achieve? 您要达到的效果是什么?

I am fairly sure sortable doesn't have this capability available by its api, but do you really need sortable or do you just need a list of draggable objects that snap to a table/list? 我相当确定sortable的api没有提供此功能,但是您是否真的需要sortable还是只需要一个可拖动对象的列表以捕捉到表/列表? does this list need to be sortable? 此列表是否需要排序?

Sortable has a 'sortchange' event, which fires when the order of a list has changed: Sortable具有一个“ sortchange”事件,该事件在列表顺序更改时触发:

$('#mysortable').bind('sortchange', function(evt,ui){
 //perform some action once the list order has changed 
});

Perhaps this link will help: http://jqueryui.com/demos/draggable/#option-connectToSortable 也许此链接会有所帮助: http : //jqueryui.com/demos/draggable/#option-connectToSortable

You could define a list of draggable elements and add the connectToSortable options, specifying the selector for the list (that you want sortable) where you would like the resulting element to be put. 您可以定义可拖动元素的列表,并添加connectToSortable选项,并指定列表的选择器(希望将其排序),将选择器放置在结果元素上。

I suspect what you actually want is to define draggable and droppable objects and targets so you can move things around and have them snap into positions and react when their positions change. 我怀疑您真正想要的是定义可拖动和可拖放的对象和目标,以便您可以移动事物并使它们捕捉到位置并在其位置改变时做出反应。

If you could be more specific about your scenario and goals I could give a more specific answer ;) 如果您可以更具体地了解自己的情况和目标,我可以给出更具体的答案;)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM