Skip to content

Commit f96dae5

Browse files
committed
Merge pull request #361 from radiolips/bugfix/detach-grid-2
Bugfix/detach grid 2
2 parents bc62227 + d521ef5 commit f96dae5

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

dist/gridstack.js

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

338-
GridStackEngine.prototype.removeNode = function(node) {
338+
GridStackEngine.prototype.removeNode = function(node, detachNode) {
339+
detachNode = typeof detachNode === 'undefined' ? true : detachNode;
339340
this._removedNodes.push(_.clone(node));
340341
node._id = null;
341342
this.nodes = _.without(this.nodes, node);
342343
this._packNodes();
343-
this._notify(node);
344+
if (detachNode) {
345+
this._notify(node);
346+
}
344347
};
345348

346349
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
@@ -1083,7 +1086,7 @@
10831086
node = this.grid.getNodeDataByDOMEl(el);
10841087
}
10851088

1086-
this.grid.removeNode(node);
1089+
this.grid.removeNode(node, detachNode);
10871090
el.removeData('_gridstack_node');
10881091
this._updateContainerHeight();
10891092
if (detachNode) {

0 commit comments

Comments
 (0)