You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "ahirner (via GitHub)" <gi...@apache.org> on 2026/01/24 14:10:45 UTC

[I] Bug Report: Table Chart Headers Misaligned with Time Shift & Hidden Columns [superset]

ahirner opened a new issue, #37413:
URL: https://github.com/apache/superset/issues/37413

   ### Bug description
   
   ## Description
   (AI generated)
   
   When using the Table Chart with Time Shift (Comparison) enabled, disabling a column via the Customize > Column configuration menu causes the table headers to become misaligned.
   The "Grouping Headers" (the headers spanning "Main", "#", "△", "%") calculate their colSpan and positions based on the full list of columns before the visibility check is applied. However, the table body renders only the visible columns. This results in headers shifting to the right or spanning too many columns, breaking the visual layout.
   
   ## Reproduction Steps
   1. Create a Table Chart in Superset.
   2. In the Data tab, enable Time Shift (e.g., "1 year ago").
   3. Verify the chart renders with comparison columns (Main, #, △, %).
   4. Go to the Customize tab.
   5. Under Column configuration, expand a column and uncheck Show visible.
   6. Result: The table body hides the column correctly, but the grouped header above it (e.g., "Main") retains the original width/position, causing misalignment.
   Technical Analysis
   File: superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
   
   The issue stems from a discrepancy in the data source used for headers versus the body:
   1.  Headers (groupHeaderColumns): Calculates groups using filteredColumnsMeta. This list excludes columns removed via the "Data" tab but includes columns hidden via the "Customize" tab (config.visible: false).
   2.  Body (columns): Renders using visibleColumnsMeta. This list excludes columns hidden via the "Customize" tab.
   Because filteredColumnsMeta has more items than visibleColumnsMeta, the indices calculated for the grouped headers do not match the indices of the rendered cells.
   Snippet (Current State)
   // Line ~705
   const groupHeaderColumns = useMemo(
     () => getHeaderColumns(filteredColumnsMeta, isUsingTimeComparison), // Uses unfiltered list
     [filteredColumnsMeta, getHeaderColumns, isUsingTimeComparison],
   );
   // ...
   // Line ~1182 (Defined too late!)
   const visibleColumnsMeta = useMemo(
     () => filteredColumnsMeta.filter(col => col.config?.visible !== false),
     [filteredColumnsMeta, getHeaderColumns],
   );
   
   ## Proposed Fix
   
   We need to align the header logic to use the same "Visible Columns" list as the body.
   1.  Move visibleColumnsMeta definition:
       Move the useMemo for visibleColumnsMeta up in the component (around line 700), before groupHeaderColumns is defined.
   2.  Update Header Calculation:
       Change groupHeaderColumns to calculate based on visibleColumnsMeta.
           const groupHeaderColumns = useMemo(
         () => getHeaderColumns(visibleColumnsMeta, isUsingTimeComparison),
         [visibleColumnsMeta, getHeaderColumns, isUsingTimeComparison],
       );
       
   3.  Update Header Rendering:
       Inside renderGroupingHeaders, ensure we are accessing column metadata from visibleColumnsMeta to match the indices.
           // Inside renderGroupingHeaders loop
       const firstColumnInGroup = visibleColumnsMeta[startPosition];
       
   Implementation Plan
   1.  Edit superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx.
   2.  Locate visibleColumnsMeta at the bottom and move it up to line ~700.
   3.  Refactor groupHeaderColumns to use visibleColumnsMeta.
   4.  Refactor renderGroupingHeaders to use visibleColumnsMeta.
   
   
   ### Screenshots/recordings
   
   Toggling off two`%` columns make the other columns move into the top level columns:
   
   <img width="891" height="60" alt="Image" src="https://github.com/user-attachments/assets/df1d01fc-0ef2-423d-96b6-162c0225c1b4" />
   
   With all columns visible, headers (and value) columns align more or less OK:
   <img width="892" height="72" alt="Image" src="https://github.com/user-attachments/assets/dd6521ba-dcde-44ed-bc38-a3c5204445b5" />
   
   ### Superset version
   
   6.0.0
   
   ### Python version
   
   Not applicable
   
   ### Node version
   
   I don't know
   
   ### Browser
   
   Safari
   
   ### Additional context
   
   Custom build but with frontend as published
   https://github.com/ahirner/nix-trickle/pkgs/container/superset-granian
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [ ] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug Report: Table Chart Headers Misaligned with Time Shift & Hidden Columns [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #37413:
URL: https://github.com/apache/superset/issues/37413#issuecomment-3794724727

   <!-- Answer -->
   Your technical analysis and proposed fix are spot on. This exact issue was fixed in [PR #37236](https://github.com/apache/superset/pull/37236), merged on 2026-01-21. The fix moves the `visibleColumnsMeta` definition earlier in the TableChart component, uses it for `groupHeaderColumns`, and updates `renderGroupingHeaders` to reference `visibleColumnsMeta`—so header and body columns stay aligned even when columns are hidden. A test was also added to ensure this bug doesn't regress.
   
   If you're on a version before this PR, upgrading to a release after 2026-01-21 will resolve the problem. If you need to patch your current build, the changes in that PR are a direct implementation of your proposed solution. Let me know if you need help with the patch or have other questions!
   
   
   <!-- Dosu Comment Footer -->
   *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).*
   
   ---
   <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/49641c53-e2e6-49e3-aced-3cc3935a8180?feedback_type=other)</sup>
   
   [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/a28d3c7e-a9d3-459e-9fb6-3a6f9ff4f357/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=Your%20technical%20analysis%20and%20proposed%20fix%20are%20spot%20on.%20This%20exact%20issue%20was%20fixed%20in%20%5BPR%20%2337236%5D%28https%3A//github.com/apache/superset/pull/37236%29%2C%20merged%20on%202026-01-21.%20The%20fix%20moves%20the%20%60visibleColumnsMeta%60%20definition%20earlier%20in%20the%20TableChart%20component%2C%20uses%20it%20for%20%60groupHeaderColumns%60%2C%20and%20updates%20%60renderGroupingHeaders%60%20to%20reference%20%60visibleColumnsMeta%60%E2%80%94so%20header%20and%20body%20columns%20stay%20aligned%20even%20when%20columns%20are%20hidden.%20A%20test%20was%20also%20added%20to%20ensure%20this%20bug%20doesn%27t%20regress.%0A%0AIf%20you%27re%20on%20a%20version%20before%20this%20PR%2C%20upgrading%20to%20a%20release%20after%2020
 26-01-21%20will%20resolve%20the%20problem.%20If%20you%20need%20to%20patch%20your%20current%20build%2C%20the%20changes%20in%20that%20PR%20are%20a%20direct%20implementation%20of%20your%20proposed%20solution.%20Let%20me%20know%20if%20you%20need%20help%20with%20the%20patch%20or%20have%20other%20questions%21)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/apache/superset/issues/37413)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Bug Report: Table Chart Headers Misaligned with Time Shift & Hidden Columns [superset]

Posted by "ahirner (via GitHub)" <gi...@apache.org>.
ahirner closed issue #37413: Bug Report: Table Chart Headers Misaligned with Time Shift & Hidden Columns
URL: https://github.com/apache/superset/issues/37413


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org