#220. Add enableMove and enableResize. Fix staticGrid.
This commit is contained in:
parent
9c51fa040f
commit
ca800454f1
5 changed files with 45 additions and 14 deletions
|
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue