JQuery UI sortables / draggable clone not working -
hi folks using ui fro drag drop, problem cannot "clone" fire.
i have 2 <ul><li></li></ul>
lists , want drag list 1 list 2 ok bit easy, getting "clone" remain in list 1 not. need / want happen drag list 1 list 2 (one way drag only), on receive in list 2 hide remove dragged item - ok sounds strange id of dragged item loads page based on id created "empty" <li>
in 2nd <ul>
so far "we" looking this:
$('ul#inputs_menu li ul').sortable({ connectwith: "ul#layout_form", }).disableselection(); $('ul#inputs_menu li ul li').sortable({ helper: "clone" }).disableselection(); $(' ul#layout_form' ).sortable({ receive: function(event, ui) { var new_item = (ui.item).attr('id'); $('ul#layout_form').append('<li><div id="'+new_item.substr(4)+'"class="'+new_item.substr(4)+' inputs radius_10" ></div></li>'); $('#'+new_item.substr(4)).load('includes/text.php?fld_name='+new_item.substr(4)); } }).disableselection();
suggestions please - thanks
instead of ui.item
original, want ui.helper
here, clone. also, can cut down on overall code , selector work using .appendto()
instead, this:
$('#inputs_menu li ul').sortable({ connectwith: "ul#layout_form", }).disableselection(); $('#inputs_menu li ul li').sortable({ helper: "clone" }).disableselection(); $('#layout_form' ).sortable({ receive: function(event, ui) { var new_item = ui.helper.id.substr(4); $('<li><div id="'+new_item+'"class="'+new_item+' inputs radius_10" ></div></li>') .appendto('#layout_form') .find("div").load('includes/text.php?fld_name='+new_item); } }).disableselection();
Comments
Post a Comment