Reputation: 867
i have a simple nested UL's and i need to make only main UL sortable not the sub UL
example
<ul class="blocks-list" id="sortme">
<li>
<a href="#" class="float-left"><img src="../templates/admin/images/icons/fugue/status.png" width="16" height="16"> Task name</a>
<ul class="tags float-right">
<li class="tag-time">5 days</li>
<li class="tag-tags">Server</li>
<li class="tag-user">You</li>
</ul>
</li>
<ul class="mini-blocks-list">
<li>
<a href="#" class="float-left"><img src="../templates/admin/images/icons/fugue/status.png" width="16" height="16"> Task name</a>
<ul class="tags float-right">
<li class="tag-time">5 days</li>
<li class="tag-user">You</li>
</ul>
</li>
</ul>
<li>
<a href="#" class="float-left"><img src="../templates/admin/images/icons/fugue/status.png" width="16" height="16"> Task name</a>
<ul class="tags float-right">
<li class="tag-time">5 days</li>
<li class="tag-user">You</li>
</ul>
</li>
</ul>
when i used this Jquery Code
$("#sortme").sortable({
update : function () {
serial = $('#sortme').sortable('serialize');
$.ajax({
url: "sort_menu.php",
type: "post",
data: serial,
error: function(){
alert("theres an error with AJAX");
}
});
}
});
it made both UL blocks-list and mini-blocks-list sortable
what i need is only to make blocks-list LI's sortable not both UL's
Upvotes: 0
Views: 98
Reputation: 2771
You can use the sortable items
option to filter exactly what you need and to keep other items from being sortable. For example items: "> li"
. docs
Upvotes: 0
Reputation: 50643
It seems a limitation in jQuery sortable, you could try this plugin or this one if you don't find out a pure jQuery solution.
Upvotes: 1