Skip to content

fix(plugin-chart-ag-grid-table): render Show summary totals row on ag-grid 36#42115

Merged
amaannawab923 merged 6 commits into
masterfrom
amaan/fix-ag-grid-table-summary-row
Jul 17, 2026
Merged

fix(plugin-chart-ag-grid-table): render Show summary totals row on ag-grid 36#42115
amaannawab923 merged 6 commits into
masterfrom
amaan/fix-ag-grid-table-summary-row

Conversation

@amaannawab923

@amaannawab923 amaannawab923 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Two rendering fixes for the AG Grid "Interactive Table" (Table v2), both involving the ag-grid 36 upgrade / found alongside it. The data pipelines are correct in both cases — the failures are purely in the render layer.

1. "Show summary" totals row not rendering (ag-grid 36 regression)

The totals row is invisible after the ag-grid 36 upgrade (#41882). The pinned bottom row is built and populated correctly — the DOM contains the row with the correct aggregated values — but ag-grid 36 leaves its row-entrance animation class ag-opacity-zero (opacity: 0) permanently applied to the pinned bottom row. Normally ag-grid removes that class on the next frame to fade the row in; under v36 it is never removed for pinned rows, so the summary row renders fully but stays transparent. Fixed by forcing pinned rows opaque in the chart's styled container.

Before

Screenshot 2026-07-17 at 12 25 21 PM

After

Screenshot 2026-07-17 at 12 33 37 PM

2. Green/Red conditional formatting not rendering on time-comparison tables

Custom conditional-formatting rules using the Green (increase) / Red (decrease) color scheme never rendered on the AG Grid table. transformProps builds basicColorColumnFormatters but nothing in the renderer consumed it (the classic plugin-chart-table does consume it via basicColorColumnFormatters[row.index][column.key]). Other schemes (alert/gradient/error/success) work because they flow through columnColorFormatters, which is consumed. Fixed by routing the Green/Red rules through the existing increase/decrease formatter path — keyed by the metric column key and merged into the row-attached basicColorFormatters map that getCellStyle (background) and NumericCellRenderer (arrow) already consume, so they render like the classic table and stay correct through client-side sorting (#105973) — and by excluding Green/Red rules from getColorFormatters (which otherwise emits an invalid 'GreenFF' background from the non-hex scheme name).

Before

Screenshot 2026-07-17 at 12 27 00 PM

After

Screenshot 2026-07-17 at 12 35 33 PM

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Both fixes are visible on the same time-comparison AG Grid table. In every screenshot the Customize tab has Show summary ✓ enabled, so the only difference is the fix.

Before (master) After (this PR)
Show summary row not rendered — the table ends at the last data row pinned Summary row visible (e.g. 28.4k)
Green/Red conditional formatting comparison cells are uncolored, no arrows cells colored green/red with increase/decrease arrows

Before

After

TESTING INSTRUCTIONS

  1. Enable the AG_GRID_TABLE_ENABLED feature flag.
  2. Summary row: aggregate AG Grid table with at least one metric → toggle Show summary on → the totals row appears pinned at the bottom (verified with and without server pagination).
  3. Green/Red CF: on a time-comparison AG Grid table, add a conditional-formatting rule using the Green (increase) / Red (decrease) color scheme on a metric → the increase/decrease cells get the green/red background + arrow. Confirm alert/gradient/error/success formatting and the "Comparison color" toggle still work.

ADDITIONAL INFORMATION

Verified against a local build on apache master with ag-grid-community 36.0.0. The summary row's computed opacity was 0 (from .ag-opacity-zero) before the fix; the Green/Red formatters were computed but had no consumer in the renderer.

…-grid 36

The "Show summary" totals row is invisible on the AG Grid Interactive
Table after the ag-grid 36 upgrade (#41882). The pinned bottom row is
built and populated correctly (the DOM contains the row with the correct
aggregated values), but ag-grid 36 leaves its row-entrance animation
class `ag-opacity-zero` (opacity: 0) permanently applied to the pinned
bottom row. Normally ag-grid removes that class on the next frame to fade
the row in; under v36 it is never removed for pinned rows, so the summary
row renders fully but stays transparent.

Force pinned rows opaque in the chart's styled container, overriding the
stuck ag-grid animation class, so the summary row is visible again.
@dosubot dosubot Bot added change:frontend Requires changing the frontend viz:charts:table Related to the Table chart labels Jul 16, 2026
@bito-code-review

bito-code-review Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #d11175

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 9eb5d2e..9eb5d2e
    • superset-frontend/plugins/plugin-chart-ag-grid-table/src/styles/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 65.13%. Comparing base (157ef61) to head (3bd8c7b).

Files with missing lines Patch % Lines
...s/plugin-chart-ag-grid-table/src/transformProps.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #42115   +/-   ##
=======================================
  Coverage   65.13%   65.13%           
=======================================
  Files        2753     2753           
  Lines      154573   154584   +11     
  Branches    35453    35463   +10     
=======================================
+ Hits       100674   100689   +15     
+ Misses      51985    51981    -4     
  Partials     1914     1914           
Flag Coverage Δ
javascript 70.72% <93.33%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ing on time-comparison tables

Custom conditional-formatting rules using the Green (increase) / Red
(decrease) color scheme did not render on the AG Grid Interactive Table.
transformProps built `basicColorColumnFormatters` but nothing in the
renderer consumed it (the classic plugin-chart-table does consume it). Other
color schemes (alert/gradient/error/success) work because they flow through
`columnColorFormatters`, which is consumed.

Route the Green/Red rules through the existing increase/decrease formatter
path: key them by the metric column key and merge them into the row-attached
`basicColorFormatters` map that getCellStyle (background) and
NumericCellRenderer (arrow) already consume, so they render like the classic
table and stay correct through client-side sorting (#105973). Also exclude
Green/Red rules from getColorFormatters to avoid an invalid '<scheme>FF'
background from a non-hex color-scheme name.
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Jul 17, 2026
@amaannawab923
amaannawab923 force-pushed the amaan/fix-ag-grid-table-summary-row branch from 1cd3287 to 4d2ee4e Compare July 17, 2026 05:46
@amaannawab923
amaannawab923 requested a review from EnxDev July 17, 2026 07:06
…acks

oxlint (no-useless-fallback-in-spread) flags the `|| {}` fallbacks when
spreading a possibly-undefined per-row formatter: `{ ...(x || {}) }` is
equivalent to `{ ...x }` since spreading undefined/null in an object
literal is a no-op. Apply the autofix so pre-commit passes.
@bito-code-review

Copy link
Copy Markdown
Contributor

The flagged issue is correct. The current merge logic creates sparse objects where missing keys for metrics without Green/Red rules result in undefined values, which then overwrite existing background colors in the AG Grid renderer. To resolve this, you should ensure the merge preserves existing values or only includes entries for columns that have active rules.

Here is a concise fix for the merge logic in superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts:

  const basicColorFormatters = (baseQuery?.data ?? []).map((_row, index) => {
    const comparison = (comparisonColorFormatters || [])[index] || {};
    const basic = (basicColorColumnFormatters || [])[index] || {};
    return { ...comparison, ...basic };
  });

This approach ensures that the resulting object is a clean merge of the two formatters without introducing undefined overwrites for missing keys. I have not checked other comments on this PR as you requested to implement this fix first. Would you like me to fetch and validate the remaining comments to address them as well?

superset-frontend/plugins/plugin-chart-ag-grid-table/src/transformProps.ts

const basicColorFormatters = (baseQuery?.data ?? []).map((_row, index) => {
    const comparison = (comparisonColorFormatters || [])[index] || {};
    const basic = (basicColorColumnFormatters || [])[index] || {};
    return { ...comparison, ...basic };
  });

… with empty basic formatter

When Green/Red conditional-format rules exist, hasBasicColorFormatters is
enabled for the whole table, but those rules only target some metric
columns. getCellStyle unconditionally overwrote the cell background with the
basic (increase/decrease) formatter's backgroundColor, which is undefined for
columns without a Green/Red rule, wiping a standard conditional-format
background on those columns.

Only apply the basic background when the column actually has an
increase/decrease formatter, preserving standard conditional formatting on
untouched columns. Comparison-color mode is unaffected (it builds a formatter
for every metric column).

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amaannawab923 thanks for handling this, can we add some tests?

…round guard

Adds unit tests for the two conditional-formatting fixes:
- getCellStyle preserves a standard conditional-format background when the
  column has no increase/decrease formatter (Green/Red rules only target some
  columns), applies the basic background when present, and skips the pinned
  summary row.
- transformProps excludes Green/Red color-scheme rules from
  columnColorFormatters while keeping standard rules.
@pull-request-size pull-request-size Bot added size/L and removed size/M labels Jul 17, 2026
@amaannawab923

amaannawab923 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

Added test @EnxDev

  • getCellStyle: preserves a standard conditional-format background when the column has no increase/decrease formatter (the regression the review caught), applies the basic background when the column does have one, and skips the pinned summary row.
  • transformProps: Green/Red color-scheme rules are excluded from columnColorFormatters (the 'GreenFF' guard) while standard rules are kept.

11 tests green locally across getCellStyle.test.ts and transformProps.test.ts.

@amaannawab923
amaannawab923 requested a review from EnxDev July 17, 2026 08:13

@EnxDev EnxDev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@amaannawab923
amaannawab923 merged commit dbef0c3 into master Jul 17, 2026
69 checks passed
@amaannawab923
amaannawab923 deleted the amaan/fix-ag-grid-table-summary-row branch July 17, 2026 08:28
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

change:frontend Requires changing the frontend plugins size/L viz:charts:table Related to the Table chart

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants