Skip to content

Commit 19f41a7

Browse files
committed
Fix one bug and another pops up. This fixes issue where passing detachNode=false to removeWidget would still cause it to be removed from the DOM.
1 parent 1c040b7 commit 19f41a7

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

dist/gridstack.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,12 +335,14 @@
335335
return node;
336336
};
337337

338-
GridStackEngine.prototype.removeNode = function(node) {
338+
GridStackEngine.prototype.removeNode = function(node, detachNode) {
339339
this._removedNodes.push(_.clone(node));
340340
node._id = null;
341341
this.nodes = _.without(this.nodes, node);
342342
this._packNodes();
343-
this._notify(node);
343+
if (typeof detachNode != 'undefined' && detachNode) {
344+
this._notify(node);
345+
}
344346
};
345347

346348
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
@@ -1083,7 +1085,7 @@
10831085
node = this.grid.getNodeDataByDOMEl(el);
10841086
}
10851087

1086-
this.grid.removeNode(node);
1088+
this.grid.removeNode(node, detachNode);
10871089
el.removeData('_gridstack_node');
10881090
this._updateContainerHeight();
10891091
if (detachNode) {

0 commit comments

Comments
 (0)