Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0a58260

Browse files
committed
add static_grid option
1 parent c162173 commit 0a58260

File tree

6 files changed

+29
-2
lines changed

6 files changed

+29
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ $(function () {
129129
- `min_width` - minimal width. If window width is less, grid will be shown in one-column mode (default: `768`)
130130
- `placeholder_class` - class for placeholder (default: `'grid-stack-placeholder'`)
131131
- `resizable` - allows to override jQuery UI resizable options. (default: `{autoHide: true, handles: 'se'}`)
132+
- `static_grid` - makes grid static (default `false`). If true widgets are not movable/resizable. You don't even need jQueryUI draggable/resizable.
132133
- `vertical_margin` - vertical gap size (default: `20`)
133134
- `width` - amount of columns (default: `12`)
134135

@@ -669,6 +670,7 @@ Changes
669670
#### v0.2.4 (development version)
670671

671672
- fix closure compiler/linter warnings
673+
- add `static_grid` option.
672674

673675
#### v0.2.3 (2015-06-23)
674676

demo/serialization.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ <h1>Serialization demo</h1>
5656
<script type="text/javascript">
5757
$(function () {
5858
var options = {
59+
static_grid: true
5960
};
6061
$('.grid-stack').gridstack(options);
6162

dist/gridstack.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
auto: true,
398398
min_width: 768,
399399
float: false,
400+
static_grid: false,
400401
_class: 'grid-stack-' + (Math.random() * 10000).toFixed(0),
401402
animate: Boolean(this.container.attr('data-gs-animate')) || false,
402403
always_show_resize_handle: opts.always_show_resize_handle || false,
@@ -473,6 +474,9 @@
473474
_.each(self.grid.nodes, function(node) {
474475
self.container.append(node.el);
475476

477+
if (self.opts.static_grid) {
478+
return;
479+
}
476480
if (!node.no_move) {
477481
node.el.draggable('disable');
478482
}
@@ -487,6 +491,10 @@
487491

488492
one_column_mode = false;
489493

494+
if (self.opts.static_grid) {
495+
return;
496+
}
497+
490498
_.each(self.grid.nodes, function(node) {
491499
if (!node.no_move) {
492500
node.el.draggable('enable');
@@ -593,6 +601,10 @@
593601
});
594602
el.data('_gridstack_node', node);
595603

604+
if (self.opts.static_grid) {
605+
return;
606+
}
607+
596608
var cell_width, cell_height;
597609

598610
var on_start_moving = function(event, ui) {

dist/gridstack.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/gridstack.min.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/gridstack.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@
397397
auto: true,
398398
min_width: 768,
399399
float: false,
400+
static_grid: false,
400401
_class: 'grid-stack-' + (Math.random() * 10000).toFixed(0),
401402
animate: Boolean(this.container.attr('data-gs-animate')) || false,
402403
always_show_resize_handle: opts.always_show_resize_handle || false,
@@ -473,6 +474,9 @@
473474
_.each(self.grid.nodes, function(node) {
474475
self.container.append(node.el);
475476

477+
if (self.opts.static_grid) {
478+
return;
479+
}
476480
if (!node.no_move) {
477481
node.el.draggable('disable');
478482
}
@@ -487,6 +491,10 @@
487491

488492
one_column_mode = false;
489493

494+
if (self.opts.static_grid) {
495+
return;
496+
}
497+
490498
_.each(self.grid.nodes, function(node) {
491499
if (!node.no_move) {
492500
node.el.draggable('enable');
@@ -593,6 +601,10 @@
593601
});
594602
el.data('_gridstack_node', node);
595603

604+
if (self.opts.static_grid) {
605+
return;
606+
}
607+
596608
var cell_width, cell_height;
597609

598610
var on_start_moving = function(event, ui) {

0 commit comments

Comments
 (0)