diff --git a/doc/CHANGES.md b/doc/CHANGES.md index 0d4605663..3ba16de67 100644 --- a/doc/CHANGES.md +++ b/doc/CHANGES.md @@ -31,6 +31,7 @@ Change log ## v0.6.3-dev (upcoming changes) +- fix [#1143](https://github.com/gridstack/gridstack.js/issues/1143) nested grids with different `acceptWidgets` class - fix [#1142](https://github.com/gridstack/gridstack.js/issues/1142) add/remove widget will also trigger change events when it should. - optimized `change` callback to save original x,y,w,h values and only call those that changed [1148](https://github.com/gridstack/gridstack.js/pull/1148) - delete `bower` since [dead](https://snyk.io/blog/bower-is-dead) for a while now diff --git a/spec/e2e/html/1143_nested_acceptWidget_types.html b/spec/e2e/html/1143_nested_acceptWidget_types.html new file mode 100644 index 000000000..066b18ea0 --- /dev/null +++ b/spec/e2e/html/1143_nested_acceptWidget_types.html @@ -0,0 +1,84 @@ + + + + + + + #1143 test + + + + + + + + + + + + +
+
+
+
+ Drag me in into the dashboard! +
+
+
+
+
+
+
+ This nested grid accepts new widget with class "newWidget"
+ The parent grid also accepts new widget but with a differenent class 'otherWidgetType'
  +
+
1
+
2
+
3
+
4
+
5
+
6
+
+ +
+
+
+
+
+ + + + diff --git a/src/gridstack.js b/src/gridstack.js index 2bf792c1c..fbdc490d0 100644 --- a/src/gridstack.js +++ b/src/gridstack.js @@ -968,6 +968,7 @@ el.data('_gridstack_node_orig', origNode); el.on('drag', onDrag); + return false; // prevent parent from receiving msg (which may be grid as well) }) .on(self.container, 'dropout', function(event, ui) { // jquery-ui bug. Must verify widget is being dropped out @@ -986,6 +987,7 @@ self.placeholder.detach(); self._updateContainerHeight(); el.data('_gridstack_node', el.data('_gridstack_node_orig')); + return false; // prevent parent from receiving msg (which may be grid as well) }) .on(self.container, 'drop', function(event, ui) { self.placeholder.detach(); @@ -1027,6 +1029,7 @@ $(ui.draggable).removeData('_gridstack_node'); $(ui.draggable).removeData('_gridstack_node_orig'); self.container.trigger('dropped', [originalNode, node]); + return false; // prevent parent from receiving msg (which may be grid as well) }); } };