I have a selector like this:
$list = $( ul.sortable );
页: 1 UI 具有可分类的 p。
网页上有多种可分类的清单。 因此,每一次选择都是在实际显示只有1次的情况下选择的,而其他选择则随着分类的崩溃而崩溃。
当晚在拖拉之后发生连火时,我就获得了第一场火的顺序,尽管最后一场大火是这样。
How can I, when I actually process the sort later in a function, pick out the particular ul that is :not(.collapsed)? Currently it looks like this:
$order = $item_list.nestedSortable( toHierarchy );
Edit:
Here is what we have on page load:
$item_list = $( ul.sortable );
$url = admin/navigation/order ; // CI Controller to process stuff
$cookie = open_links ;
$data_callback = function(event, ui) {
// Grab the group id so we can update the right links
return { group : ui.item.parents( section.box ).attr( rel ) };
}
// Do sort
sort_tree($item_list, $url, $cookie, $data_callback);
最终,上述尼伯为获得命令和将贾克斯带给控制员。
如果我改变上述选择,那么所有ul子都不会被适用,并且可以分类。 因此,我估计,如果能够用某种方式将这种区别与“树木功能”区分开来,我可以正确操作。
在这里,我与以下各方合作:
sort_tree = function($item_list, $url, $cookie, data_callback, post_sort_callback)
{
// collapse all ordered lists but the top level
$item_list.find( ul ).children().hide();
// this gets ran again after drop
var refresh_tree = function() {
// add the minus icon to all parent items that now have visible children
$item_list.parent().find( ul li:has(li:visible) ).removeClass().addClass( minus );
// add the plus icon to all parent items with hidden children
$item_list.parent().find( ul li:has(li:hidden) ).removeClass().addClass( plus );
// remove the class if the child was removed
$item_list.parent().find( ul li:not(:has(ul)) ).removeClass();
// call the post sort callback
post_sort_callback && post_sort_callback();
}
refresh_tree();
// set the icons properly on parents restored from cookie
$($.cookie($cookie)).has( ul ).toggleClass( minus plus );
// show the parents that were open on last visit
$($.cookie($cookie)).children( ul ).children().show();
// show/hide the children when clicking on an <li>
$item_list.find( li ).live( click , function()
{
$(this).children( ul ).children().slideToggle( fast );
$(this).has( ul ).toggleClass( minus plus );
var items = [];
// get all of the open parents
$item_list.find( li.minus:visible ).each(function(){ items.push( # + this.id) });
// save open parents in the cookie
$.cookie($cookie, items.join( , ), { expires: 1 });
return false;
});
$item_list.nestedSortable({
disableNesting: no-nest ,
forcePlaceholderSize: true,
handle: div ,
helper: clone ,
items: li ,
opacity: .4,
placeholder: placeholder ,
tabSize: 25,
listType: ul ,
tolerance: pointer ,
toleranceElement: > div ,
stop: function(event, ui) {
post = {};
// create the array using the toHierarchy method
post.order = $item_list.nestedSortable( toHierarchy );
// pass to third-party devs and let them return data to send along
if (data_callback) {
post.data = data_callback(event, ui);
}
// refresh the tree icons - needs a timeout to allow nestedSort
// to remove unused elements before we check for their existence
setTimeout(refresh_tree, 5);
$.post(SITE_URL + $url, post );
}
});