From a4eb3e03a06c6a0fdc99e38ca178e6e318e7e2ae Mon Sep 17 00:00:00 2001 From: Morgan Pizzini Date: Thu, 26 Oct 2017 15:41:45 +0200 Subject: [PATCH 1/3] add 'moveIn' and 'listNo' data attribute handler --- jquery.nestable.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/jquery.nestable.js b/jquery.nestable.js index 9439bb3..4cd8b72 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('moveIn'); + var listNo = this.pointEl.closest('.dd-list').data('listNo'); + if (itemMoveIn !== listNo) { + return; + } /** * move vertical */ From 5e1da81a4d065d10b50bbfd482fa341d3d97d79b Mon Sep 17 00:00:00 2001 From: Morgan Pizzini Date: Thu, 26 Oct 2017 16:02:33 +0200 Subject: [PATCH 2/3] Update Readme.md --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 From d937f5c9a3cac2e0fabe951b68920f6764d540d4 Mon Sep 17 00:00:00 2001 From: Morgan Pizzini Date: Thu, 26 Oct 2017 18:56:08 +0200 Subject: [PATCH 3/3] bug fix --- jquery.nestable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.nestable.js b/jquery.nestable.js index 4cd8b72..8214d0c 100644 --- a/jquery.nestable.js +++ b/jquery.nestable.js @@ -994,8 +994,8 @@ 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('moveIn'); - var listNo = this.pointEl.closest('.dd-list').data('listNo'); + var itemMoveIn = this.dragEl.find(opt.itemNodeName).data('move-in'); + var listNo = this.pointEl.closest('.dd-list').data('list-no'); if (itemMoveIn !== listNo) { return; }