I am trying to create a re-ordering of the page drag and drop feature on my CMS. As some of the pages have sub pages, we have a lot of lists nested within lists. An example of the code:
$(document).ready(function(){
$(function() {
$('#contentLeft ul').sortable({
update: function() {
var order = $('#contentLeft ul').sortable('serialize');
alert(order);
}
});
});
});
<div id="contentLeft">
<ul id="sitemap">
<li id="page_1" class="page_container">
Test
<ul>
<li id="page_20">Nested one</li>
<li id="page_30">nested 2</li>
<li id="page_40"> Nested 6</li>
</ul>
</li>
<li id="page_4" class="page_container">
Test
</li>
<li id="page_5" class="page_container">
Test
</li>
</ul>
</div>
In the above example, when I move things around and serialize the ul, i get the list of top level lists elements returned (page[]=1, page[]=4, page[]=5). What I need is for it to serialize ALL of the li tags, including the children li tags and get something like (page[]=1, page[]=20, page[]=30, page[]=40, page[]=4, page[]=5).
I have tried applying serialize quite simply to
but had no luck.
Could anyone point me in the right direcition?
Many Thanks