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

Skip to content

Commit 50a96dd

Browse files
committed
resizeToContent() fix for nested grid with content above
1 parent 6e2e59d commit 50a96dd

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

doc/CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ Change log
129129
* rem [#3022](https://github.com/gridstack/gridstack.js/pull/3022) removed ES5 support (IE doesn't support CSS vars needed now)
130130
* rem [#3027](https://github.com/gridstack/gridstack.js/pull/3027) remove legacy code support for disableOneColumnMode, oneColumnSize, oneColumnModeDomSort
131131
* fix [#3028](https://github.com/gridstack/gridstack.js/pull/3028) `updateOptions()` no longer modifies passed in struct. only field we check are being handled too.
132+
* fix [#3029](https://github.com/gridstack/gridstack.js/pull/3029) `resizeToContent()` fix for nested grid with content above
132133

133134
## 12.0.0 (2025-04-12)
134135
* feat: [#2854](https://github.com/gridstack/gridstack.js/pull/2854) Removed dynamic stylesheet and migrated to CSS vars. Thank you [lmartorella](https://github.com/lmartorella)

src/gridstack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ export class GridStack {
14271427
// sub-grid - use their actual row count * their cell height, BUT append any content outside of the grid (eg: above text)
14281428
wantedH = n.subGrid.getRow() * n.subGrid.getCellHeight(true);
14291429
const subRec = n.subGrid.el.getBoundingClientRect();
1430-
const parentRec = n.subGrid.el.parentElement.getBoundingClientRect();
1430+
const parentRec = el.getBoundingClientRect();
14311431
wantedH += subRec.top - parentRec.top;
14321432
} else if (n.subGridOpts?.children?.length) {
14331433
// not sub-grid just yet (case above) wait until we do

0 commit comments

Comments
 (0)