Repository navigation
fix(ag-grid-table): apply small number format to grid cells - #46689
Open
Raman-Katiyar wants to merge 1 commit into
Open
Raman-Katiyar wants to merge 1 commit into
Raman-Katiyar wants to merge 1 commit into
Conversation
The AG Grid Table painted cells through valueFormatter(), which used col.formatter(value) and never read col.config.d3SmallNumberFormat, so a column with a small number format rendered 0.1 as 0.10 while the classic Table rendered 10.00%. Mirror formatColumnValue's small-number branch in valueFormatter, and drop the backend report path's AG Grid exception in client_processing.table() so an emailed report matches the chart.
Contributor
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #46689 +/- ##
=======================================
Coverage 86.42% 86.42%
=======================================
Files 3183 3183
Lines 222605 222607 +2
Branches 52996 53000 +4
=======================================
+ Hits 192377 192398 +21
+ Misses 26758 26739 -19
Partials 3470 3470
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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
Fixes #46688
The AG Grid Table painted grid cells through
valueFormatter(), which usedcol.formatter(value)and never readcol.config.d3SmallNumberFormat, so a column with a small number format rendered0.1as0.10while the classic Table rendered10.00%. This mirrorsformatColumnValue's small-number branch insidevalueFormatter: a numeric column with|value| < 1now usesgetSmallNumberFormatter(col.formatter, col.config?.d3SmallNumberFormat, col.config?.currencyFormat); a null/blank small format falls back to the plain formatter. The existing CurrencyFormatter branch (row context for AUTO mode) and the string fallback are unchanged.The backend report path is fixed in the same PR:
table()insuperset/charts/client_processing.pydeliberately skipped the small format for AG Grid, so an emailed report would have shown0.10while the chart shows10.00%. The exception is removed, so a report applies the format the same way the chart does.Tree mode is a follow-up, not part of this change:
TreeTableColumncarries no column config, so plumbingd3SmallNumberFormatinto Tree mode child columns needs a separate change to the transform pipeline and types.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
0.1(format,.2f, small format.2%) read0.10; classic Table read10.00%; the emailed report read0.10.10.00%;1234.56reads1,234.56everywhere.TESTING INSTRUCTIONS
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/formatValue.test.ts: 6/6 pass (fail-before on master: 4 failed / 2 passed). Full plugin suite: 9 failed / 994 passed, identical to the master baseline (pre-existing TreeTable failures only).tests/unit_tests/charts/test_client_processing.py: fail-before 2 failed, pass-after 2 passed; full module 417 passed.packages/*/liboutputs);formatValue.tsitself has 0 errors and the same condition exists on master.10.00%/1,234.56; the chart-data API withresult_type: post_processed(the report path) returns the same values for both charts.ADDITIONAL INFORMATION