add maxWidth/maxHeight
This commit is contained in:
parent
29857f4131
commit
02f0eba64d
5 changed files with 93 additions and 8 deletions
31
README.md
31
README.md
|
|
@ -45,8 +45,10 @@ Join gridstack.js on Slack: https://gridstackjs.troolee.com
|
|||
- [isAreaEmpty(x, y, width, height)](#isareaemptyx-y-width-height)
|
||||
- [locked(el, val)](#lockedel-val)
|
||||
- [makeWidget(el)](#makewidgetel)
|
||||
- [minWidth(el, val)](#minwidthel-val)
|
||||
- [maxHeight(el, val)](#maxheightel-val)
|
||||
- [minHeight(el, val)](#minheightel-val)
|
||||
- [maxWidth(el, val)](#maxwidthel-val)
|
||||
- [minWidth(el, val)](#minwidthel-val)
|
||||
- [movable(el, val)](#movableel-val)
|
||||
- [move(el, x, y)](#moveel-x-y)
|
||||
- [removeWidget(el, detachNode)](#removewidgetel-detachnode)
|
||||
|
|
@ -380,19 +382,33 @@ var grid = $('.grid-stack').data('gridstack');
|
|||
grid.makeWidget('gsi-1');
|
||||
```
|
||||
|
||||
### minWidth(el, val)
|
||||
### maxHeight(el, val)
|
||||
|
||||
Set the minWidth for a widget.
|
||||
Set the `maxHeight` for a widget.
|
||||
|
||||
- `el` - widget to modify.
|
||||
- `val` - A numeric value of the number of rows
|
||||
|
||||
### minHeight(el, val)
|
||||
|
||||
Set the `minHeight` for a widget.
|
||||
|
||||
- `el` - widget to modify.
|
||||
- `val` - A numeric value of the number of rows
|
||||
|
||||
### maxWidth(el, val)
|
||||
|
||||
Set the `maxWidth` for a widget.
|
||||
|
||||
- `el` - widget to modify.
|
||||
- `val` - A numeric value of the number of columns
|
||||
|
||||
### minHeight(el, val)
|
||||
### minWidth(el, val)
|
||||
|
||||
Set the minHeight for a widget.
|
||||
Set the `minWidth` for a widget.
|
||||
|
||||
- `el` - widget to modify.
|
||||
- `val` - A numeric value of the number of rows
|
||||
- `val` - A numeric value of the number of columns
|
||||
|
||||
### movable(el, val)
|
||||
|
||||
|
|
@ -787,8 +803,9 @@ Changes
|
|||
|
||||
#### v0.2.5-dev (Development version)
|
||||
|
||||
- `cell_height` and `vertical_margin` can now be string (e.g. '3em', '20px') (Thanks to @jlowcs)
|
||||
- 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.
|
||||
|
||||
#### v0.2.4 (2016-02-15)
|
||||
|
||||
|
|
|
|||
34
dist/gridstack.js
vendored
34
dist/gridstack.js
vendored
|
|
@ -991,6 +991,23 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.maxHeight = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNaN(val)) {
|
||||
node.maxHeight = (val || false);
|
||||
el.attr('data-gs-max-height', val);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.minHeight = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
|
|
@ -1008,6 +1025,23 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.maxWidth = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNaN(val)) {
|
||||
node.maxWidth = (val || false);
|
||||
el.attr('data-gs-max-width', val);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.minWidth = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
|
|
|
|||
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
|
|
@ -991,6 +991,23 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.maxHeight = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNaN(val)) {
|
||||
node.maxHeight = (val || false);
|
||||
el.attr('data-gs-max-height', val);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.minHeight = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
|
|
@ -1008,6 +1025,23 @@
|
|||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.maxWidth = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
el = $(el);
|
||||
var node = el.data('_gridstack_node');
|
||||
if (typeof node == 'undefined' || node == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isNaN(val)) {
|
||||
node.maxWidth = (val || false);
|
||||
el.attr('data-gs-max-width', val);
|
||||
}
|
||||
});
|
||||
return this;
|
||||
};
|
||||
|
||||
GridStack.prototype.minWidth = function(el, val) {
|
||||
el = $(el);
|
||||
el.each(function(index, el) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue