views:

26

answers:

0

Hi I currently have a sortable UL wih multiple LI's, each one of which may have a a sortable UL within it. I can sort the nested ULs fine using sortable( 'toArray' ). Each LI has an ID which I can read back on the server to determine the order. The problem is that this just not work on the outer UL, as toarray picks up every LI, including the ones that are within the nested LI's.

Here is the code that gets my outer UL sortable:

 $("#sortablesections", div).sortable({
            items: 'li',
            axis: 'y',
            opacity: 0.7,
            scroll: true,
            handle: '.handle',
            update: function(sorted) {
                $.ajax({
                    url: '/Asset/ReorderSections',
                    type: "POST",
                    data: { 'positions': $(this).sortable('toArray'), "formID": formID }
                });
            }
        });

The following will return 'positions' with 4 values.

<ul>
<li id="1">
<ul>
<li id="1">item</li>
<li id="2">item</li>
</li>
<li id="2"></li>
</ul>

When I'm only really interesting into getting an array of the outer sortables id's.

TIA!