Skip to content

Commit 52368d6

Browse files
committed
Add attache_node option when adding widget
1 parent 718aea6 commit 52368d6

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

dist/gridstack.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@
107107
}else{
108108
_.each(collision_nodes,function(collision_node){
109109
self.move_node(collision_node, collision_node.x , node.y + node.height,
110-
collision_node.width, collision_node.height, true);
110+
collision_node.width, collision_node.height, true);
111111
});
112112
}
113113
};
@@ -682,7 +682,7 @@
682682
return;
683683
}
684684
self.grid.move_node(node, x, y);
685-
self._update_container_height();
685+
self._update_container_height();
686686
}
687687

688688
},
@@ -723,14 +723,16 @@
723723
}
724724
};
725725

726-
GridStack.prototype.add_widget = function(el, x, y, width, height, auto_position) {
726+
GridStack.prototype.add_widget = function(el, x, y, width, height, auto_position, attach_node) {
727727
el = $(el);
728728
if (typeof x != 'undefined') el.attr('data-gs-x', x);
729729
if (typeof y != 'undefined') el.attr('data-gs-y', y);
730730
if (typeof width != 'undefined') el.attr('data-gs-width', width);
731731
if (typeof height != 'undefined') el.attr('data-gs-height', height);
732732
if (typeof auto_position != 'undefined') el.attr('data-gs-auto-position', auto_position ? 'yes' : null);
733-
this.container.append(el);
733+
if(attach_node) {
734+
this.container.append(el);
735+
}
734736
this._prepare_element(el);
735737
this._update_container_height();
736738
this._trigger_change_event(true);

dist/gridstack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)