michael-s-molina commented on code in PR #42088:
URL: https://github.com/apache/superset/pull/42088#discussion_r3632316555


##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/getCellStyle.ts:
##########
@@ -55,29 +55,55 @@ const getCellStyle = (params: CellStyleParams) => {
   let backgroundColor;
   let color;
   if (hasColumnColorFormatters) {
+    const applyFormatter = (
+      formatter: ColorFormatters[number],
+      valueToFormat: typeof value,
+    ) => {
+      const formatterResult =
+        valueToFormat || valueToFormat === 0
+          ? formatter.getColorFromValue(valueToFormat)
+          : false;
+      if (formatterResult) {
+        if (
+          formatter.objectFormatting === ObjectFormattingEnum.TEXT_COLOR ||
+          formatter.toTextColor
+        ) {
+          color = formatterResult;
+        } else if (
+          formatter.objectFormatting !== ObjectFormattingEnum.CELL_BAR
+        ) {
+          backgroundColor = formatterResult;
+        }
+      }
+    };
+
     columnColorFormatters!
       .filter(formatter => {
+        if (formatter.columnFormatting) {
+          return formatter.columnFormatting === colDef.field;
+        }
         const colTitle = formatter?.column?.includes('Main')
           ? formatter?.column?.replace('Main', '').trim()
           : formatter?.column;
         return colTitle === colDef.field;
       })
       .forEach(formatter => {
-        const formatterResult =
-          value || value === 0 ? formatter.getColorFromValue(value) : false;
-        if (formatterResult) {
-          if (
-            formatter.objectFormatting === ObjectFormattingEnum.TEXT_COLOR ||
-            formatter.toTextColor
-          ) {
-            color = formatterResult;
-          } else if (
-            formatter.objectFormatting !== ObjectFormattingEnum.CELL_BAR
-          ) {
-            backgroundColor = formatterResult;
-          }
-        }
+        const valueToFormat = formatter.columnFormatting
+          ? node?.data?.[formatter.column]
+          : value;

Review Comment:
   Fixed in 4ca949723f. `valueToFormat` was keyed off `formatter.column`, which 
can be a legacy "Main colname" display label for time-comparison columns rather 
than the row's actual data key. Added a `resolveColumnKey` helper (reusing the 
same label-stripping logic already used for the match filter) and applied it at 
both lookup sites.



-- 
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