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.

This commit is contained in:
d 2016-02-24 13:20:04 -05:00
commit 19f41a72a8
4 changed files with 13 additions and 9 deletions

8
dist/gridstack.js vendored
View file

@ -335,12 +335,14 @@
return node;
};
GridStackEngine.prototype.removeNode = function(node) {
GridStackEngine.prototype.removeNode = function(node, detachNode) {
this._removedNodes.push(_.clone(node));
node._id = null;
this.nodes = _.without(this.nodes, node);
this._packNodes();
this._notify(node);
if (typeof detachNode != 'undefined' && detachNode) {
this._notify(node);
}
};
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
@ -1083,7 +1085,7 @@
node = this.grid.getNodeDataByDOMEl(el);
}
this.grid.removeNode(node);
this.grid.removeNode(node, detachNode);
el.removeData('_gridstack_node');
this._updateContainerHeight();
if (detachNode) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -335,12 +335,14 @@
return node;
};
GridStackEngine.prototype.removeNode = function(node) {
GridStackEngine.prototype.removeNode = function(node, detachNode) {
this._removedNodes.push(_.clone(node));
node._id = null;
this.nodes = _.without(this.nodes, node);
this._packNodes();
this._notify(node);
if (typeof detachNode != 'undefined' && detachNode) {
this._notify(node);
}
};
GridStackEngine.prototype.canMoveNode = function(node, x, y, width, height) {
@ -1083,7 +1085,7 @@
node = this.grid.getNodeDataByDOMEl(el);
}
this.grid.removeNode(node);
this.grid.removeNode(node, detachNode);
el.removeData('_gridstack_node');
this._updateContainerHeight();
if (detachNode) {