You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See [example](http://gridstack.github.io/gridstack.js/demo/advance.html)
71
75
-`animate` - turns animation on (default: `false`)
72
76
-`auto` - if `false` gridstack will not initialize existing items (default: `true`)
73
77
-`cellHeight` - one cell height (default: `60`). Can be:
74
78
* an integer (px)
75
79
* a string (ex: '100px', '10em', '10rem', '10%')
76
80
* 0 or null, in which case the library will not generate styles for rows. Everything must be defined in CSS files.
77
-
*`'auto'` - height will be calculated to match cell width (initial square grid).
81
+
*`'auto'` - height will be calculated cell square initially.
78
82
-`column` - number of columns (default: `12`) which can change on the fly with `column(N)` as well. See [example](http://gridstackjs.com/demo/column.html)
79
-
-`ddPlugin` - class that implement drag'n'drop functionallity for gridstack. If `false` grid will be static. (default: `null` - first available plugin will be used)
83
+
-`ddPlugin` - class that implement drag'n'drop functionality for gridstack. If `false` grid will be static. (default: `null` - first available plugin will be used)
80
84
-`disableDrag` - disallows dragging of widgets (default: `false`).
81
85
-`disableOneColumnMode` - disables the onColumnMode when the window width is less than minWidth (default: 'false')
82
86
-`disableResize` - disallows resizing of widgets (default: `false`).
@@ -87,7 +91,7 @@ gridstack.js API
87
91
-`handleClass` - draggable handle class (e.g. `'grid-stack-item-content'`). If set `handle` is ignored (default: `null`)
88
92
-`itemClass` - widget class (default: `'grid-stack-item'`)
89
93
-`maxRow` - maximum rows amount. Default is `0` which means no max.
90
-
-`minRow` - minimum rows amount. Default is `0`. You can also do this with `min-height` CSS attribute on the grid div in pixels, which will round to the closest row.
94
+
-`minRow` - minimum rows amount which is handy to prevent grid from collapsing when empty. Default is `0`. You can also do this with `min-height` CSS attribute on the grid div in pixels, which will round to the closest row.
91
95
-`minWidth` - minimal width. If window width is less than or equal to, grid will be shown in one-column mode (default: `768`)
92
96
-`oneColumnModeDomSort` - set to `true` if you want oneColumnMode to use the DOM order and ignore x,y from normal multi column layouts during sorting. This enables you to have custom 1 column layout that differ from the rest. (default?: `false`)
93
97
-`placeholderClass` - class for placeholder (default: `'grid-stack-placeholder'`)
@@ -104,26 +108,30 @@ gridstack.js API
104
108
105
109
## Grid attributes
106
110
107
-
-`data-gs-animate` - turns animation on
108
-
-`data-gs-column` - amount of columns. Setting non-default value must be supported by equivalent change in CSS, [see docs here](https://github.com/gridstack/gridstack.js#change-grid-columns).
111
+
most of the above options are also available as HTML attributes using the `data-gs-` name prefix with standard dash lower case naming convention (ex: `data-gs-column`, `data-gs-min-row`, etc..).
112
+
113
+
Extras:
109
114
-`data-gs-current-row` - (internal) current rows amount. Set by the library only. Can be used by the CSS rules.
110
-
-`data-gs-max-row` - maximum rows amount. Default is `0` which means no max.
111
-
-`data-gs-min-row` - minimum rows amount. Default is `0`. You can also do this with `min-height` CSS attribute on the grid div in pixels, which will round to the closest row.
112
-
-`data-gs-row` - fix grid number of rows. This is a shortcut of writing `data-gs-min-row="N" data-gs-max-row="N"`. (default `0` no constrain)
115
+
116
+
## Item Options
117
+
118
+
options you can pass when calling `addWidget()`
119
+
120
+
-`autoPosition` - tells to ignore `x` and `y` attributes and to place element to the first available position. Having either one missing will also do that.
121
+
-`x`, `y` - (number) element position in row/column. Note: if one is missing this will `autoPosition` the item
122
+
-`width`, `height` - (number) element size in row/column (default 1x1)
123
+
-`maxWidth`, `minWidth`, `maxHeight`, `minHeight` - element constraints in row/column (default none)
124
+
-`locked` - means another widget wouldn't be able to move it during dragging or resizing.
125
+
The widget can still be dragged or resized by the user.
126
+
You need to add `noResize` and `noMove` attributes to completely lock the widget.
127
+
-`noResize` - disable element resizing
128
+
-`noMove` - disable element moving
129
+
-`resizeHandles` - sets resize handles for a specific widget.
130
+
-`id`- (number | string) good for quick identification (for example in change event)
113
131
114
132
## Item attributes
115
133
116
-
-`data-gs-x`, `data-gs-y` - (number) element position in row/column. Note: if one is missing this will `autoPosition` the item
117
-
-`data-gs-width`, `data-gs-height` - (number) element size in row/column
118
-
-`data-gs-id`- (number | string) good for quick identification (for example in change event)
119
-
-`data-gs-max-width`, `data-gs-min-width`, `data-gs-max-height`, `data-gs-min-height` - element constraints in row/column
120
-
-`data-gs-no-resize` - disable element resizing
121
-
-`data-gs-no-move` - disable element moving
122
-
-`data-gs-auto-position` - tells to ignore `data-gs-x` and `data-gs-y` attributes and to place element to the first available position. Having either one missing will also do that.
123
-
-`data-gs-locked` - the widget will be locked. It means another widget wouldn't be able to move it during dragging or resizing.
124
-
The widget can still be dragged or resized. You need to add `data-gs-no-resize` and `data-gs-no-move` attributes
125
-
to completely lock the widget.
126
-
-`data-gs-resize-handles` - sets resize handles for a specific widget.
134
+
all item options are also available as HTML attributes using the `data-gs-` name prefix with standard dash lower case naming convention (ex: `data-gs-x`, `data-gs-min-width`, etc..).
127
135
128
136
## Events
129
137
@@ -263,7 +271,7 @@ starts batch updates. You will see no changes until `commit()` method is called.
0 commit comments