javascript - jQueryUI: draggable and sortable -
you should see demo.
what want do? have sortable list , few draggable items. when dragg , drop draggable item sortable list, want add "dropped" item attribute data-target value of max data-targets, sortable list, plus one. that, have elements id 1 n (last one), because later use , send array ajax:
$("#sortable").sortable("toarray", {attribute: "data-target"});
the problem data-target attribute adds draggable element (the element, outside sortable list), not dropped element (the element, appears inside sortable list after dragging it).
so, need add data-target element, has red border on picture, code adds attribute element blue border.
and, please, 1 more question: maybe can jqueryui method? example, find refresh() method, don't know how work. maybe method add new data-target @ once without manipulation, made code?
thanks lot!
Comments
Post a Comment