update gridstack.js

This commit is contained in:
Pavel Reznikov 2015-03-10 23:27:16 -07:00
commit bfaa893400

View file

@ -673,18 +673,21 @@
return this.grid.can_be_placed_with_respect_to_height(node);
};
GridStack.prototype.remove_widget = function (el) {
GridStack.prototype.remove_widget = function (el, detach_node) {
detach_node = typeof detach_node === 'undefined' ? true : detach_node;
el = $(el);
var node = el.data('_gridstack_node');
this.grid.remove_node(node);
el.remove();
el.removeData('_gridstack_node');
this._update_container_height();
if (detach_node)
el.remove();
};
GridStack.prototype.remove_all = function () {
GridStack.prototype.remove_all = function (detach_node) {
_.each(this.grid.nodes, function (node) {
node.el.remove();
});
this.remove_widget(node.el, detach_node);
}, this);
this.grid.nodes = [];
this._update_container_height();
};
@ -694,7 +697,7 @@
el.each(function (index, el) {
el = $(el);
var node = el.data('_gridstack_node');
if (typeof node == 'undefined') {
if (typeof node == 'undefined' || node == null) {
return;
}
@ -714,7 +717,7 @@
el.each(function (index, el) {
el = $(el);
var node = el.data('_gridstack_node');
if (typeof node == 'undefined') {
if (typeof node == 'undefined' || node == null) {
return;
}
@ -744,7 +747,7 @@
el.each(function (index, el) {
el = $(el);
var node = el.data('_gridstack_node');
if (typeof node == 'undefined') {
if (typeof node == 'undefined' || node == null) {
return;
}
@ -757,7 +760,7 @@
GridStack.prototype._update_element = function (el, callback) {
el = $(el).first();
var node = el.data('_gridstack_node');
if (typeof node == 'undefined') {
if (typeof node == 'undefined' || node == null) {
return;
}