verdier commented on code in PR #45540:
URL: https://github.com/apache/superset/pull/45540#discussion_r4345462158
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/filterValueGetter.ts:
##########
@@ -19,16 +19,20 @@
*/
import { ValueGetterParams } from
'@superset-ui/core/components/ThemedAgGridReact';
-const filterValueGetter = (params: ValueGetterParams) => {
- const raw = params.data[params.colDef.field as string];
- const formatter = params.colDef.valueFormatter as Function;
- if (!raw || !formatter) return null;
- const formatted = formatter({
- value: raw,
- });
-
- const numeric = parseFloat(String(formatted).replace('%', '').trim());
- return Number.isNaN(numeric) ? null : numeric;
+// Reads the raw value rather than parsing the formatted text back, which
+// carries the locale's separators and SI suffixes. A percent format shows the
+// value scaled by 100, so the filter compares against that scaled number,
+// shifted in decimal notation to avoid binary noise (0.07 * 100).
+const filterValueGetter = (params: ValueGetterParams, percent: boolean) => {
+ const raw = params.data?.[params.colDef.field as string];
Review Comment:
Good catch, thanks. Applied in c91b104: the getter now reads
`context.dataKey`, falling back to `field`, and there's a `useColDefs` test
with a `Main %share` comparison column that fails without it.
--
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]