Skip to content

Commit 673a92f

Browse files
author
Alain Dumesny
committed
many columns test case, some fixes
Created a sample for #810 with 30 columns, but not seeing issues in that PR. In the meantime I found those issues: * fix README talking about custom columns # * fix SASS code to handle >12 columns as you need to override stack-item min-width (we have 8.3333% otherwise = 1/12) * while testing incorrectly passed 'auto' for gridItem width (prop on grid cellHeight) so fixed code to handle wrong strings passed for x,y,w,h * updated test cases
1 parent d86a6e9 commit 673a92f

File tree

6 files changed

+503
-14
lines changed

6 files changed

+503
-14
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ If you're still experiencing issues on touch devices please check [#444](https:/
176176

177177
## Change grid width
178178

179-
To change grid width (columns count), to addition to `width` option, CSS rules
179+
To change grid width (columns count), in addition to setting the `width` grid option CSS rules
180180
for `.grid-stack-item[data-gs-width="X"]` and `.grid-stack-item[data-gs-x="X"]` have to be changed accordingly.
181181

182182
For instance for 3-column grid you need to rewrite CSS to be:
@@ -205,13 +205,15 @@ For 4-column grid it should be:
205205

206206
and so on.
207207

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)):
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:
209209

210210
```sass
211211
.grid-stack > .grid-stack-item {
212212
213213
$gridstack-columns: 12;
214214
215+
min-width: (100% / $gridstack-columns);
216+
215217
@for $i from 1 through $gridstack-columns {
216218
&[data-gs-width='#{$i}'] { width: (100% / $gridstack-columns) * $i; }
217219
&[data-gs-x='#{$i}'] { left: (100% / $gridstack-columns) * $i; }
@@ -221,11 +223,11 @@ Here is a SASS code snippet which can make life easier (Thanks to @ascendantofra
221223
}
222224
```
223225

224-
Or you can include `gridstack-extra.css`. See below for more details.
226+
Or you can include `gridstack-extra.css` which include [1-12] column sizes. See below for more details.
225227

226228
## Extra CSS
227229

228-
There are few extra CSS batteries in `gridstack-extra.css` (`gridstack-extra.min.css`).
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.
229231

230232
### Different grid widths
231233

doc/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ gridstack.js API
104104

105105
## Item attributes
106106

107-
- `data-gs-x`, `data-gs-y` - element position. Note: if one is missing this will `autoPosition` the item
108-
- `data-gs-width`, `data-gs-height` - element size
109-
- `data-gs-id`- good for quick identification (for example in change event)
110-
- `data-gs-max-width`, `data-gs-min-width`, `data-gs-max-height`, `data-gs-min-height` - element constraints
107+
- `data-gs-x`, `data-gs-y` - (number) element position in row/column. Note: if one is missing this will `autoPosition` the item
108+
- `data-gs-width`, `data-gs-height` - (number) element size in row/column
109+
- `data-gs-id`- (number | string) good for quick identification (for example in change event)
110+
- `data-gs-max-width`, `data-gs-min-width`, `data-gs-max-height`, `data-gs-min-height` - element constraints in row/column
111111
- `data-gs-no-resize` - disable element resizing
112112
- `data-gs-no-move` - disable element moving
113113
- `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.

0 commit comments

Comments
 (0)