li", handle : '.handle', a...">

List of sortable jquery nests

I have this code

$(document).ready(function() {
    $("#test-list").sortable({
        items: "> li",
        handle : '.handle',
        axis: 'y',
        opacity: 0.6,
        update : function () {
            var order = $('#test-list').sortable('serialize');
            $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats");
        }
    });
    $("#test-sub").sortable({
        containment: "ul",
        items: "li",
        handle : '.handle',
        axis: 'y',
        opacity: 0.6,
        update : function () {
            var order = $('#test-list').sortable('serialize');
            $("#info").load("process-sortable.asp?"+order+"&id=catid&order=orderid&table=tblCats");
        }
    });
});

for this type of UL

<ul id="test-list">
  <li></li>
  <li>
    <ul id="test-sub">
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
      <li></li>
   </ul>
  </li>
  <li></li>
  <li></li>
  <li></li>
  <li></li>
</ul>

but it can be changed dynamically ... when I drag the main one, it works when I do this using children, it will drag the main file

what's wrong?

+3
source share
2 answers

I wrote about this. This is not so straightforward and a bit confusing, but just real.

http://a.shinynew.me/post/4641524290/jquery-ui-nested-sortables

+4
source

I wrote a drag and drop script specifically designed for nested structures Check this out ... https://supraniti.imtqy.com/Lean-Mean-Drag-and-Drop/

0
source

Source: https://habr.com/ru/post/1737905/


All Articles