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
* grid options `width` is now `columns`, and `height` is now `maxRows` which match what they are.
* Old names are still supported for now (with console warnings)
* updated test (required), samples (optional), readme
* re-wrote entire custom column section. Hopefully much easier to find/use now.
To change grid width (columns count), in addition to setting the `width` grid option CSS rules
180
-
for `.grid-stack-item[data-gs-width="X"]` and `.grid-stack-item[data-gs-x="X"]` have to be changed accordingly.
178
+
GridStack makes it very easy if you need [1-12] columns out of the box (default is 12), but you always need **2 things** if you need to customize this:
179
+
180
+
1) Change the `columns` grid option when creating a grid to your number N
181
+
```js
182
+
$('.grid-stack').gridstack( {columns:N} );
183
+
```
184
+
185
+
2) and change your HTML accordingly if **N < 12** (else custom CSS section next). Without this, things will not render/work correctly.
`gridstack-extra.css` (and `gridstack-extra.min.css`) defines CSS for grids with custom [1-12] columns. Anything more and you'll need to generate the SASS/CSS yourself (see next).
195
+
196
+
See example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html) with 6 columns
197
+
198
+
## Custom columns CSS
199
+
200
+
If you need > 12 columns or want to generate the CSS manually (else see above) you will need to generate CSS rules for `.grid-stack-item[data-gs-width="X"]` and `.grid-stack-item[data-gs-x="X"]`.
181
201
182
202
For instance for 3-column grid you need to rewrite CSS to be:
183
203
@@ -205,7 +225,7 @@ For 4-column grid it should be:
205
225
206
226
and so on.
207
227
208
-
Here is a SASS code snippet which can make life easier (Thanks to @ascendantofrain, [#81](https://github.com/gridstack/gridstack.js/issues/81) and @StefanM98, [#868](https://github.com/gridstack/gridstack.js/issues/868)) and use a site like [sassmeister.com](https://www.sassmeister.com/) to generate CSS if you need to:
228
+
Better yet, here is a SASS code snippet which can make life much easier (Thanks to @ascendantofrain, [#81](https://github.com/gridstack/gridstack.js/issues/81) and @StefanM98, [#868](https://github.com/gridstack/gridstack.js/issues/868)) and you can use sites like [sassmeister.com](https://www.sassmeister.com/) to generate the CSS for you instead:
209
229
210
230
```sass
211
231
.grid-stack > .grid-stack-item {
@@ -223,25 +243,6 @@ Here is a SASS code snippet which can make life easier (Thanks to @ascendantofra
223
243
}
224
244
```
225
245
226
-
Or you can include `gridstack-extra.css` which include [1-12] column sizes. See below for more details.
227
-
228
-
## Extra CSS
229
-
230
-
There are few extra CSS batteries in `gridstack-extra.css` (`gridstack-extra.min.css`) that defines CSS for grids with [1-12] columns. Anything more and you'll need to generate the above SASS/CSS yourself.
231
-
232
-
### Different grid widths
233
-
234
-
You can use other than 12 grid width:
235
-
236
-
```html
237
-
<divclass="grid-stack grid-stack-N">...</div>
238
-
```
239
-
```javascript
240
-
$('.grid-stack').gridstack({width:N});
241
-
```
242
-
243
-
See example: [2 grids demo](http://gridstack.github.io/gridstack.js/demo/two.html)
244
-
245
246
## Override resizable/draggable options
246
247
247
248
You can override default `resizable`/`draggable` options. For instance to enable other then bottom right resizing handle
Copy file name to clipboardExpand all lines: doc/CHANGES.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,11 +24,11 @@ Change log
24
24
25
25
## v0.5.2-dev (upcoming changes)
26
26
27
+
- grid options `width` is now `columns`, and `height` is now `maxRows` which match what they are. Old names are still supported for now (with console warnings). Also various fixes for custom # of columns and re-wrote entire doc section ([#1053](https://github.com/gridstack/gridstack.js/issues/1053)).
27
28
- fix widgets not animating when animate: true is used. on every move, styles were recreated-fix should slightly improve gridstack.js speed ([#937](https://github.com/gridstack/gridstack.js/issues/937)).
28
29
- fix moving widgets when having multiple grids. jquery-ui workaround ([#1043](https://github.com/gridstack/gridstack.js/issues/1043)).
29
30
- switch to eslint ([#763](https://github.com/gridstack/gridstack.js/issues/763)).
30
31
- null values to addWidget() exception fix ([#1042](https://github.com/gridstack/gridstack.js/issues/1042)).
31
-
- various fixes for custom # of columns (readme, safer code) ([#1053](https://github.com/gridstack/gridstack.js/issues/1053)).
-`handleClass` - draggable handle class (e.g. `'grid-stack-item-content'`). If set `handle` is ignored (default: `null`)
80
-
-`height` - maximum rows amount. Default is `0` which means no maximum rows
80
+
-`columns` - amount of columns (default: `12`)
81
+
-`maxRows` - maximum rows amount. Default is `0` which means no maximum rows
81
82
-`float` - enable floating widgets (default: `false`) See [example](http://gridstackjs.com/demo/float.html)
82
83
-`itemClass` - widget class (default: `'grid-stack-item'`)
83
84
-`minWidth` - minimal width. If window width is less than or equal to, grid will be shown in one-column mode (default: `768`)
@@ -93,13 +94,12 @@ gridstack.js API
93
94
-`verticalMargin` - vertical gap size (default: `20`). Can be:
94
95
* an integer (px)
95
96
* a string (ex: '2em', '20px', '2rem')
96
-
-`width` - amount of columns (default: `12`)
97
97
98
98
## Grid attributes
99
99
100
100
-`data-gs-animate` - turns animation on
101
-
-`data-gs-width` - 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-width).
102
-
-`data-gs-height` - maximum rows amount. Default is `0` which means no maximum rows.
101
+
-`data-gs-columns` - 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).
102
+
-`data-gs-maxRows` - maximum rows amount. Default is `0` which means no maximum rows.
103
103
-`data-gs-current-height` - current rows amount. Set by the library only. Can be used by the CSS rules.
/** draggable handle class (e.g. 'grid-stack-item-content'). If set 'handle' is ignored (default?: null) */
437
437
handleClass?: string;
438
438
439
+
/**
440
+
* number of columns (default?: 12). Note: IF you change this, CSS also have to change. See https://github.com/gridstack/gridstack.js#change-grid-columns
441
+
*/
442
+
columns?: number;
443
+
439
444
/**
440
445
* maximum rows amount. Default? is 0 which means no maximum rows
441
446
*/
442
-
height?: number;
447
+
maxRows?: number;
443
448
444
449
/**
445
450
* enable floating widgets (default?: false) See example (http://gridstack.github.io/gridstack.js/demo/float.html)
@@ -513,10 +518,5 @@ interface GridstackOptions {
513
518
* (internal?) unit for verticalMargin (default? 'px')
0 commit comments