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

Skip to content

resizeToContent() fix for nested grid with content above #3029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ Change log
* rem [#3022](https://github.com/gridstack/gridstack.js/pull/3022) removed ES5 support (IE doesn't support CSS vars needed now)
* rem [#3027](https://github.com/gridstack/gridstack.js/pull/3027) remove legacy code support for disableOneColumnMode, oneColumnSize, oneColumnModeDomSort
* 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.
* fix [#3029](https://github.com/gridstack/gridstack.js/pull/3029) `resizeToContent()` fix for nested grid with content above

## 12.0.0 (2025-04-12)
* 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)
Expand Down
2 changes: 1 addition & 1 deletion src/gridstack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1427,7 +1427,7 @@ export class GridStack {
// sub-grid - use their actual row count * their cell height, BUT append any content outside of the grid (eg: above text)
wantedH = n.subGrid.getRow() * n.subGrid.getCellHeight(true);
const subRec = n.subGrid.el.getBoundingClientRect();
const parentRec = n.subGrid.el.parentElement.getBoundingClientRect();
const parentRec = el.getBoundingClientRect();
wantedH += subRec.top - parentRec.top;
} else if (n.subGridOpts?.children?.length) {
// not sub-grid just yet (case above) wait until we do
Expand Down