开发者

jQuery sortable replace instead of append?

Hey guys was just wondering if there was anywa开发者_StackOverflow社区y 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! 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? does this list need to be sortable?

Sortable has a 'sortchange' event, which fires when the order of a list has changed:

$('#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

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.

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 ;)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜