javascript - drag and sortable only work first time -
i implementing drag , sort function. have 2 draggable area. can take @ url
https://study-navin10sharma.c9.io/
1.just take city example , drop active reason work , take again city out of active reason still fine. again if try add city in active reason city block invisible.
with each drag perform sort operation dynamically.
$(function() { $( "#sortable1, #sortable2" ).sortable({ connectwith: ".connectedsortable", helper: 'clone', containment:"document", revert:"true", tolerance:"pointer" }); }); $("#sortable2").sortable({ stop: function ( event, div){ data = $(this).sortable('toarray', { attribute: 'data-id' }); //here perform our ajax request }, receive: function (event, ul) { ul.item.remove(); } }); //with each drag connect sort $("#sortable1>div").draggable({ connecttosortable: "#sortable2", helper: "clone", revert: "invalid", axis :"y" }); $("#sortable2>div").draggable({ connecttosortable: "#sortable2", helper: "clone", revert: "invalid" }); //here html reference <div id="sortable2" class="connectedsortable"> <span class="ui-sortable-handle"> active</span></div> <div id="sortable1" class="connectedsortable"> // here have list of element want drag </div>
one more things once drag item sorting trigger not way may once element drop sorting need start. please me sort out problem. if there else want let me know.
thanks.
Comments
Post a Comment