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

Skip to content

Commit a56f1cb

Browse files
authored
Merge pull request gridstack#1847 from adumesny/master
gridstack#1794 fix rem unit size for save+reload
2 parents 4457568 + b6f4b20 commit a56f1cb

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

demo/serialization.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ <h1>Serialization demo</h1>
2424
</div>
2525

2626
<script type="text/javascript">
27-
let grid = GridStack.init({minRow: 1, cellHeight: 70}); // don't let it collapse when empty
27+
let grid = GridStack.init({
28+
minRow: 1, // don't let it collapse when empty
29+
cellHeight: '7rem'
30+
});
2831

2932
grid.on('added removed change', function(e, items) {
3033
let str = '';

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Change log
6565

6666
* fix [#1817](https://github.com/gridstack/gridstack.js/issues/1817) Enable passing of DragEvent to gridstack dropped event. Thanks [@onepartsam](https://github.com/onepartsam)
6767
* fix [#1835](https://github.com/gridstack/gridstack.js/issues/1835) Layout incorrectly restored when node has a minimum width. Thanks [@hssm](https://github.com/hssm)
68+
* fix [#1794](https://github.com/gridstack/gridstack.js/issues/1794) addGrid() does not recognize rem cellHeightUnit
6869

6970
## 4.2.6 (2021-7-11)
7071

src/gridstack.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,11 @@ export class GridStack {
302302
// make the cell content square initially (will use resize/column event to keep it square)
303303
this.cellHeight(undefined, false);
304304
} else {
305+
// append unit if any are set
306+
if (typeof this.opts.cellHeight == 'number' && this.opts.cellHeightUnit && this.opts.cellHeightUnit !== GridDefaults.cellHeightUnit) {
307+
this.opts.cellHeight = this.opts.cellHeight + this.opts.cellHeightUnit;
308+
delete this.opts.cellHeightUnit;
309+
}
305310
this.cellHeight(this.opts.cellHeight, false);
306311
}
307312

0 commit comments

Comments
 (0)