Repository navigation
feat(common): add sticky headers to autoHeight grids - #1351
Open
ghiscoding wants to merge 2 commits into
Open
ghiscoding wants to merge 2 commits into
ghiscoding wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1351 +/- ##
=======================================
Coverage 93.41% 93.42%
=======================================
Files 34 34
Lines 13524 13537 +13
Branches 4093 4098 +5
=======================================
+ Hits 12634 12647 +13
Misses 686 686
Partials 204 204 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Collaborator
Author
autoHeight grids
- Give the sticky header root an opaque background so rows no longer show through an empty pre-header, and use the theme's header colour (#f8f8f8) as the fallback for the top-header panel. - Link the auto-height example by its full URL, as docs/examples.md does, so the docs link check passes. - Move the sticky header docs under Sticky docking, after the page introduction. - Add the missing final newline to autoHeightOption.interface.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6pac-ai
approved these changes
Nov 16, 2026
6pac-ai
left a comment
Collaborator
There was a problem hiding this comment.
Looks good, approving. The approach is sound: overflow: clip on the content root, unlike hidden, doesn't create a scroll container, so the header row can stick without any scroll listeners. I pushed one follow-up commit, 9e7f230:
- Rows showing through the pre-header. When the pre-header panel has no columns, as in example 11, it is transparent, so rows that scroll under it showed through. The sticky header root now has an opaque
--slick-header-bg-colorbackground. The top-header panel's fallback colour now matches the theme default (#f8f8f8instead of#ececec). - Docs link.
/examples/example11-autoheight.htmlfailednpm run links(missing page). I switched it to the full URL, the same formdocs/examples.mduses. - Docs placement. The section sat above the page intro and the v6 tip, so I moved it under Sticky docking.
- Newline. Added the missing final newline to
autoHeightOption.interface.ts.
Verification
- Vitest: 1574/1574 pass. The build,
tsc --noEmitand lint are clean. - Cypress: example 11 passes. The 6 pinning specs passed on 603680b, 46/46 tests.
- In the browser (example 11):
- The layers stack correctly while the page scrolls: top header at 20px, then the header, then the header row.
- Headers and filters stay aligned with the cells when the grid is scrolled horizontally.
setHeaderRowVisibility(),setPreHeaderPanelVisibility()andsetTopHeaderPanelVisibility()update the CSS variables.setOptions()switches sticky mode on and off.- With
pinning.columns.leftset, cells and headers are in the same positions with sticky on and off.
Note for consumers: widening the type to boolean | AutoHeightOption means TypeScript code that assigns options.autoHeight to a boolean will no longer compile. The PR description and the JSDoc already mention this.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
autoHeight: { stickyHeader: true }to keep the top-header panel, pre-header, column headers, and header row visible while an auto-height grid is scrolled.This implements the feature requested in Discussion #994, adapted from slickgrid-universal PR #2934.
Why
An auto-height grid grows to show all its rows, so the page scrolls instead of the grid. On long grids, the column titles and filters otherwise scroll out of view.
Changes
autoHeightto accept a boolean or anAutoHeightOptionobject. The object form enables auto-height, andstickyHeader: trueenables sticky header layers. Existing boolean configurations retain their behavior.position: stickywithout scroll listeners. The content root usesoverflow: clipso the header row can stick to the scrolling ancestor.--slick-sticky-header-topoffsets the headers below fixed page content; it defaults to0px.--slick-sticky-header-z-indexcontrols their stacking order; it defaults to7.Validation
npm run build: passed.vitest run --config vitest.config.mts src/__tests__/slickGrid.spec.ts: 411 tests passed.Comments
Code that reads
gridOptions.autoHeightas a boolean may need a truthy check such as!!gridOptions.autoHeight, because the option can now also be an object.Sticky positioning uses the nearest ancestor with a scrolling mechanism. An ancestor with
overflow: autoorhiddencan prevent headers from sticking to the page if it is not the element being scrolled.AI / LLM assistance
Checklist