EnxDev opened a new pull request, #41754:
URL: https://github.com/apache/superset/pull/41754

   ### SUMMARY
   
   Makes the Interactive Table (`ag-grid-table`) "Show summary" option 
available and functional in Raw Records mode, and moves the checkbox into the 
Customize tab.
   
   **Before**, two independent gates made the summary aggregate-only: the 
control was declared with `visibility: isAggMode` (so it never rendered in Raw 
Records — a value set in Aggregate mode silently persisted via `resetOnHide: 
false` but was inert), and `buildQuery` only emitted the totals query when 
`queryMode === Aggregate`.
   
   **After**:
   - In Raw Records mode, enabling **Customize → Show summary** pins a bottom 
row with a server-side `SUM` per numeric column, computed across the full 
filtered dataset (row limit does not apply — the same semantics the option 
already has in Aggregate mode). Non-numeric cells stay blank. Only columns 
backed by a dataset (physical or calculated) column are summed; free-form SQL 
expression columns are excluded.
   - The checkbox now lives at the top of the **Visual formatting** section in 
the Customize tab, for both query modes.
   
   Design decisions worth calling out:
   
   - **Numeric-column plumbing.** `buildQuery` has no datasource column 
metadata, so `transformProps` derives the numeric, dataset-backed subset of the 
raw selection and the chart mirrors it into `ownState.rawSummaryColumns` — the 
same mechanism the plugin already uses for `metricSqlExpressions`. The totals 
query is then a standard extra query (`columns: []`, `row_limit: 0`, SIMPLE 
`SUM` adhoc metrics labeled with the column names), reusing the existing 
AG-Grid-filter exclusion (`totalsExtras`) logic. A raw chart with the summary 
enabled performs one priming re-query on first load (the base query is a cache 
hit; only the totals query is new work).
   - **Customize-tab placement requires `renderTrigger`.** Explore classifies a 
section into the Customize tab only when every control in it has 
`renderTrigger` (`ControlPanelsContainer.tsx`); adding `show_totals` to Visual 
formatting without it would have relocated all nine formatting controls to the 
Data tab. Since `renderTrigger` toggles don't re-query, the chart requests 
totals through the plugin's existing ownState re-query channel 
(`totalsRequested`) — the same sanctioned mechanism as server pagination. 
Toggle-on shows the standard loading state and issues the same query the old 
Data-tab checkbox produced; toggle-off hides the row instantly and issues one 
cache-friendly query to clear the request flag. All totals-related ownState 
writes are combined into a single delta per render to avoid same-render 
clobbering between the raw-mode prime and the re-query nudge.
   - **Known bounded corner:** with the summary enabled but no summable columns 
(raw mode with zero numeric columns, or aggregate mode with zero metrics), one 
nudge re-query fires, `buildQuery` adds no totals query, and the flag goes 
dormant — no pinned row is shown and no further queries are issued.
   - The legacy `plugin-chart-table` keeps `show_totals` in the Data tab and 
aggregate-only; this PR intentionally changes only the AG Grid table plugin.
   - No docs change: there is no existing table-viz options page documenting 
"Show summary" to extend.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: in Raw Records mode the Customize tab has no "Show summary" option 
(it only appeared in the Data tab in Aggregate mode).
   After: Customize → Visual formatting starts with "Show summary"; enabling it 
in Raw Records pins a SUM row.
   (Screenshots to be attached.)
   
   ### TESTING INSTRUCTIONS
   
   1. Enable the `AG_GRID_TABLE_ENABLED` feature flag.
   2. Create an Interactive Table chart in **Raw Records** query mode with at 
least one numeric column (e.g. `birth_names` with `num`).
   3. Open **Customize** → the **Visual formatting** section starts with **Show 
summary**; enable it.
   4. The grid re-queries once and pins a bottom row with the SUM of each 
numeric column, computed over the full filtered dataset (independent of row 
limit and server pagination).
   5. Toggle it off — the row disappears immediately. Toggle on/off across 
interactions (sort, filter, paginate) — the row always reflects the current 
filters (AG Grid column filters are excluded from totals, matching 
Aggregate-mode behavior).
   6. Switch to Aggregate mode — Show summary behaves as before, now from the 
Customize tab.
   7. Unit/component coverage: `npx jest plugins/plugin-chart-ag-grid-table` 
(250 tests).
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   - [ ] Has associated issue:
   - [x] Required feature flags: `AG_GRID_TABLE_ENABLED`
   - [x] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to