add static_grid option

This commit is contained in:
Pavel Reznikov 2015-07-16 18:49:28 -07:00
parent c162173e87
commit 0a58260563
6 changed files with 29 additions and 2 deletions

View file

@ -129,6 +129,7 @@ $(function () {
- `min_width` - minimal width. If window width is less, grid will be shown in one-column mode (default: `768`)
- `placeholder_class` - class for placeholder (default: `'grid-stack-placeholder'`)
- `resizable` - allows to override jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`)
- `static_grid` - makes grid static (default `false`). If true widgets are not movable/resizable. You don't even need jQueryUI draggable/resizable.
- `vertical_margin` - vertical gap size (default: `20`)
- `width` - amount of columns (default: `12`)
@ -669,6 +670,7 @@ Changes
#### v0.2.4 (development version)
- fix closure compiler/linter warnings
- add `static_grid` option.
#### v0.2.3 (2015-06-23)

View file

@ -56,6 +56,7 @@
<script type="text/javascript">
$(function () {
var options = {
static_grid: true
};
$('.grid-stack').gridstack(options);

12
dist/gridstack.js vendored
View file

@ -397,6 +397,7 @@
auto: true,
min_width: 768,
float: false,
static_grid: false,
_class: 'grid-stack-' + (Math.random() * 10000).toFixed(0),
animate: Boolean(this.container.attr('data-gs-animate')) || false,
always_show_resize_handle: opts.always_show_resize_handle || false,
@ -473,6 +474,9 @@
_.each(self.grid.nodes, function(node) {
self.container.append(node.el);
if (self.opts.static_grid) {
return;
}
if (!node.no_move) {
node.el.draggable('disable');
}
@ -487,6 +491,10 @@
one_column_mode = false;
if (self.opts.static_grid) {
return;
}
_.each(self.grid.nodes, function(node) {
if (!node.no_move) {
node.el.draggable('enable');
@ -593,6 +601,10 @@
});
el.data('_gridstack_node', node);
if (self.opts.static_grid) {
return;
}
var cell_width, cell_height;
var on_start_moving = function(event, ui) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -397,6 +397,7 @@
auto: true,
min_width: 768,
float: false,
static_grid: false,
_class: 'grid-stack-' + (Math.random() * 10000).toFixed(0),
animate: Boolean(this.container.attr('data-gs-animate')) || false,
always_show_resize_handle: opts.always_show_resize_handle || false,
@ -473,6 +474,9 @@
_.each(self.grid.nodes, function(node) {
self.container.append(node.el);
if (self.opts.static_grid) {
return;
}
if (!node.no_move) {
node.el.draggable('disable');
}
@ -487,6 +491,10 @@
one_column_mode = false;
if (self.opts.static_grid) {
return;
}
_.each(self.grid.nodes, function(node) {
if (!node.no_move) {
node.el.draggable('enable');
@ -593,6 +601,10 @@
});
el.data('_gridstack_node', node);
if (self.opts.static_grid) {
return;
}
var cell_width, cell_height;
var on_start_moving = function(event, ui) {