I have table rows that are sortable depending on whether certain radio buttons are checked or not. The sortables are initialized on document.ready
as follows:
I know this is old, but had a similar problem. I had my sortable items in groupings. I wanted certain groups to be sortable anywhere and some to only be sortable to a subsection of groups.
Items from noSort
can sort anywhere. Items from canSort
can only sort into other canSort
blocks.
$("#sortBlock").sortable({
items: "> div.itemBlock > .item" // this makes sure only the sub items will be sortable
});
Then setting this rule after the init seemed to do the trick.
$("#sortBlock").sortable( "option", "items", "> div:not(#noSort) > .item");
Was trying to do it dynamically in the start/stop events, but this did the trick, not sure "why", so test well.
- 热议问题