jquery ui - Sorting with item and Drag and drop for delete -
i want gp_item should sortable , when drag , drop under gp_delete area gp_item should deleted.
when did, either working sorting or deleting. both not working together.
<div id='container_gp'> <div id='1' class='gp_item'> graph 1</div> <div id='2' class='gp_item'> graph 2</div> <div id='3' class='gp_item'> graph 3</div> </div> <div id='gp_delete'>drop delete here </div>
i have written that.
$('.gp_item').draggable({ revert: true, proxy:'clone' }); $("#gp_delete").droppable({ activeclass: "active", drop: function(event, ui) { if(confirm("are sure wish delete")) { //delete code ui.draggable.remove(); } } });
i modified bit code , works, trick set draggable
, sortable
features on container not on single elements:
$('#container_gp').sortable({revert: 100}).draggable({ revert: 'invalid', proxy: 'clone' }).disableselection() $("#gp_delete").droppable({ activeclass: "active", hoverclass: "ui-state-highlight", accept: '#container_gp div', drop: function (event, ui) { if (confirm("are sure wish delete")) { ui.draggable.remove(); } } });
working fiddle: http://jsfiddle.net/ckwke/2/
Comments
Post a Comment