Repository navigation
fix(table): align group headers correctly when filtering time compari… - #37236
Conversation
…son columns When using Table charts with Time Comparison and filtering columns (showing only % diff, collapsing groups, etc.), the group headers would become misaligned with the actual data columns. Root cause: Two issues in header rendering logic: 1. groupHeaderColumns was computed from filteredColumnsMeta while getColumnConfigs used visibleColumnsMeta (which also filters out config.visible === false) 2. Object.entries iteration didn't ensure correct visual column order Fix: - Move visibleColumnsMeta definition earlier and use it for groupHeaderColumns - Sort Object.entries by startPosition before rendering headers - Update renderGroupingHeaders lookup to use visibleColumnsMeta for consistency Added test case to verify header alignment when columns are hidden via config. Fixes apache#37074
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Code Review Agent Run #141e04Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
|
CodeAnt AI finished reviewing your PR. |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR fixes a bug where group headers in Table charts with Time Comparison would become misaligned with data columns when filtering or hiding specific comparison columns.
Changes:
- Moved
visibleColumnsMetacomputation earlier in the code to ensure consistent column indexing - Updated
groupHeaderColumnsto usevisibleColumnsMetainstead offilteredColumnsMetafor accurate header positioning - Added sorting of group header entries by column position to maintain correct left-to-right order
- Added comprehensive test case to verify header alignment with hidden columns
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx | Fixed header alignment logic by using visibleColumnsMeta consistently and sorting header entries by position |
| superset-frontend/plugins/plugin-chart-table/test/testData.ts | Added test data with hidden comparison columns to reproduce issue #37074 |
| superset-frontend/plugins/plugin-chart-table/test/TableChart.test.tsx | Added test case validating correct group header alignment and colSpan values when columns are hidden |
|
🎪 Showtime deployed environment on GHA for e068057 • Environment: http://54.201.231.61:8080 (admin/admin) |
SBIN2010
left a comment
There was a problem hiding this comment.
LGTM! Thank you for the contribution!
SUMMARY
When using Table charts with Time Comparison and filtering columns (showing only % diff, collapsing groups, etc.), the group headers would become misaligned with the actual data columns.
Root cause: Two issues in header rendering logic:
groupHeaderColumnswas computed fromfilteredColumnsMetawhilegetColumnConfigsusedvisibleColumnsMeta(which also filters outconfig.visible === false)Object.entriesiteration didn't ensure correct visual column orderFix:
visibleColumnsMetadefinition earlier and use it forgroupHeaderColumnsObject.entriesbystartPositionbefore rendering headersrenderGroupingHeaderslookup to usevisibleColumnsMetafor consistencyAdded test case to verify header alignment when columns are hidden via config.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - This is a logic fix. The visual result is that group headers now correctly align with their respective data columns when filtering time comparison columns.
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION
Fixes #37074