jquery - Sortable function when content is updated via ajax -



jquery - Sortable function when content is updated via ajax -

i have list populated via ajax. list can add together , delete items via ajax , sort them. have 2 issues it.

the first 1 here , it's still unresolved: jquery dynamic drag'n drop doesn't update order (after sorting list number of items come database won't update until refresh)

the sec 1 worse. after update contents on list via ajax (say add together new item), sortable function stops working until reload page. seems .live won't work sortable , i'm out of ideas one. i'll add together of code:

my list goes this:

<ul id="listaruta"> <li> ... </li> </ul>

my script sorting items:

$(function() { $("ul#listaruta").sortable({ opacity: 0.6, cursor: 'move', update: function() { var order = $(this).sortable("serialize") + '&action=updaterecordslistings'; $.post("/plugins/drag/updatedb.php", order); } }); });

i'm using sorting function: http://www.webresourcesdepot.com/wp-content/uploads/file/jquerydragdrop/

after searching lot more found answer: jquery live , sortable

this added code create work:

$(document).ajaxsuccess(function() { $("ul#listaruta").sortable({ opacity: 0.6, cursor: 'move', update: function() { var order = $(this).sortable("serialize") + '&action=updaterecordslistings'; $.post("/plugins/drag/updatedb.php", order); } }); });

jquery ajax sortable

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -