Merge pull request #334 from radiolips/bugfix/staticGrid
Bugfix/static grid
This commit is contained in:
commit
47817a3489
19
README.md
19
README.md
|
@ -41,6 +41,8 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
|||
- [destroy()](#destroy)
|
||||
- [disable()](#disable)
|
||||
- [enable()](#enable)
|
||||
- [enableMove(doEnable)](#enablemovedoenable)
|
||||
- [enableResize(doEnable)](#enableresizedoenable)
|
||||
- [getCellFromPixel(position)](#getcellfrompixelposition)
|
||||
- [isAreaEmpty(x, y, width, height)](#isareaemptyx-y-width-height)
|
||||
- [locked(el, val)](#lockedel-val)
|
||||
|
@ -343,6 +345,22 @@ grid.movable('.grid-stack-item', true);
|
|||
grid.resizable('.grid-stack-item', true);
|
||||
```
|
||||
|
||||
### enableMove(doEnable)
|
||||
|
||||
Enables/disables grid moving (current and added widgets). This is a shortcut for:
|
||||
|
||||
```javascript
|
||||
grid.movable(this.container.children('.' + this.opts.itemClass), doEnable);
|
||||
```
|
||||
|
||||
### enableResize(doEnable)
|
||||
|
||||
Enables/disables grid resizing (current and added widgets). This is a shortcut for:
|
||||
|
||||
```javascript
|
||||
grid.resizable(this.container.children('.' + this.opts.itemClass), doEnable);
|
||||
```
|
||||
|
||||
### getCellFromPixel(position)
|
||||
|
||||
Get the position of the cell under a pixel on screen.
|
||||
|
@ -805,6 +823,7 @@ Changes
|
|||
- update names to respect js naming convention
|
||||
- `cellHeight` and `verticalMargin` can now be string (e.g. '3em', '20px') (Thanks to @jlowcs)
|
||||
- add `maxWidth`/`maxHeight` methods.
|
||||
- add `enableMove`/`enableResize` methods.
|
||||
|
||||
#### v0.2.4 (2016-02-15)
|
||||
|
||||
|
|
18
dist/gridstack.js
vendored
18
dist/gridstack.js
vendored
|
@ -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();
|
||||
};
|
||||
|
||||
|
|
2
dist/gridstack.min.js
vendored
2
dist/gridstack.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/gridstack.min.map
vendored
2
dist/gridstack.min.map
vendored
File diff suppressed because one or more lines are too long
|
@ -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…
Reference in a new issue