#220. Add enableMove and enableResize. Fix staticGrid.

This commit is contained in:
d 2016-02-18 16:48:16 -05:00
commit ca800454f1
5 changed files with 45 additions and 14 deletions

View file

@ -757,10 +757,6 @@
});
el.data('_gridstack_node', node);
if (self.opts.staticGrid) {
return;
}
var cellWidth;
var cellHeight;
@ -843,11 +839,11 @@
resize: dragOrResize
}));
if (node.noMove || this._isOneColumnMode()) {
if (node.noMove || this._isOneColumnMode() || this.opts.staticGrid) {
el.draggable('disable');
}
if (node.noResize || this._isOneColumnMode()) {
if (node.noResize || this._isOneColumnMode() || this.opts.staticGrid) {
el.resizable('disable');
}
@ -964,6 +960,14 @@
return this;
};
GridStack.prototype.enableMove = function(doEnable) {
this.movable(this.container.children('.' + this.opts.itemClass), doEnable);
};
GridStack.prototype.enableResize = function(doEnable) {
this.resizable(this.container.children('.' + this.opts.itemClass), doEnable);
};
GridStack.prototype.disable = function() {
this.movable(this.container.children('.' + this.opts.itemClass), false);
this.resizable(this.container.children('.' + this.opts.itemClass), false);
@ -1195,6 +1199,8 @@
GridStack.prototype.setStatic = function(staticValue) {
this.opts.staticGrid = (staticValue === true);
this.enableMove(!staticValue);
this.enableResize(!staticValue);
this._setStaticClass();
};