File tree Expand file tree Collapse file tree 3 files changed +25
-1
lines changed
Expand file tree Collapse file tree 3 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ Change log
9393## 8.2.1-dev (TBD)
9494* fix [ #2349 ] ( https://github.com/gridstack/gridstack.js/issues/2349 ) grid NoMove vs item NoMove support
9595* fix [ #2352 ] ( https://github.com/gridstack/gridstack.js/issues/2352 ) .ui-draggable-dragging z-index for modal dialogs
96+ * fix [ #2357 ] ( https://github.com/gridstack/gridstack.js/issues/2357 ) NaN inf loop when using cellHeight rem/em
9697
9798## 8.2.1 (2023-05-26)
9899* fix: make sure ` removeNode() ` uses internal _ id (unique) and not node itself (since we clone those often)
Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < head >
3+ < title > REM demo</ title >
4+ < link rel ="stylesheet " href ="../../../demo.css "/>
5+ < script src ="../../../dist/gridstack-all.js "> </ script >
6+ </ head >
7+ < body >
8+ < div class ="grid-stack "> </ div >
9+ < script type ="text/javascript ">
10+ let items = [
11+ { x : 0 , y : 0 } ,
12+ { x : 1 , y : 0 } ,
13+ ] ;
14+ let count = 0 ;
15+ items . forEach ( d => d . content = String ( count ++ ) ) ;
16+
17+ let grid = GridStack . init ( {
18+ // cellHeight: '90',
19+ cellHeight : '8rem' ,
20+ } ) . load ( items ) ;
21+ </ script >
22+ </ body >
23+ </ html>
Original file line number Diff line number Diff line change @@ -732,7 +732,7 @@ export class GridStack {
732732 // else get first cell height
733733 let el = this . el . querySelector ( '.' + this . opts . itemClass ) as HTMLElement ;
734734 if ( el ) {
735- let height = Utils . toNumber ( el . getAttribute ( 'gs-h' ) ) ;
735+ let height = Utils . toNumber ( el . getAttribute ( 'gs-h' ) ) || 1 ; // since we don't write 1 anymore
736736 return Math . round ( el . offsetHeight / height ) ;
737737 }
738738 // else do entire grid and # of rows (but doesn't work if min-height is the actual constrain)
You can’t perform that action at this time.
0 commit comments