nestedSortable
nestedSortable copied to clipboard
Allow parent change on items that are not parents?
Long time admirer of this amazing jQuery work of art. It's just amazing! Genius really.
Quick question for anyone: See below? The top item 0 is the root node. The rest are all parent items. I'd like to allow child items to move freely between parent items, but not let parent items with depth of 1 be moved into another parent.
disableParentChange: true disables parents moving under another parent, yes. But, it doesn't allow for children to move from one parent to another.
0: {item_id: null, parent_id: null, depth: 0, left: 1, right: 16}
1: {item_id: '1', parent_id: null, depth: 1, left: 2, right: 3}
2: {item_id: '3', parent_id: null, depth: 1, left: 4, right: 5}
3: {item_id: '2', parent_id: null, depth: 1, left: 6, right: 7}
4: {item_id: '4', parent_id: null, depth: 1, left: 8, right: 9}
5: {item_id: '5', parent_id: null, depth: 1, left: 10, right: 11}
6: {item_id: '6', parent_id: null, depth: 1, left: 12, right: 13}
7: {item_id: '7', parent_id: null, depth: 1, left: 14, right: 15}
length: 8
How would I use the isAllowed function to say "If item has depth equal to 1, don't allow the move/drop.?