diff --git a/README.md b/README.md index 8d2e2e4..ed5f61e 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,29 @@ Then activate with jQuery like so: $('.dd').nestable({ /* config options */ }); ``` +Fix items membership with HTML like so: +```html +
+
    +
  1. + Parent1 +
      +
    1. Child1
    2. +
    3. Child2
    4. +
    +
  2. +
  3. + Parent2 +
      +
    1. Child3
    2. +
    3. Child4
    4. +
    +
  4. +
+
+``` +Items with `data-move-in="2"` can be dropped only in list with `data-list-no="2"`: "Child" Items can not be at the same level of their fathers + ### Events `change`: For using an .on handler in jquery diff --git a/jquery.nestable.js b/jquery.nestable.js index 9439bb3..8214d0c 100644 --- a/jquery.nestable.js +++ b/jquery.nestable.js @@ -994,6 +994,11 @@ var pointElRoot = this.pointEl.closest('.' + opt.rootClass), isNewRoot = this.dragRootEl.data('nestable-id') !== pointElRoot.data('nestable-id'); + var itemMoveIn = this.dragEl.find(opt.itemNodeName).data('move-in'); + var listNo = this.pointEl.closest('.dd-list').data('list-no'); + if (itemMoveIn !== listNo) { + return; + } /** * move vertical */