From 920ef20e2392afd0f9e4a7c40eb17aa146916b8b Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Thu, 23 Feb 2023 14:53:32 +0100 Subject: [PATCH] Fix table chart's metrics columns --- .../plugin-chart-table/src/TableChart.tsx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx index 2d81a4dca6de3..9843a4ae8b17b 100644 --- a/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx +++ b/superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx @@ -365,7 +365,11 @@ export default function TableChart( onContextMenu && !isRawRecords ? ( value: D, - cellPoint: { key: string; value: DataRecordValue }, + cellPoint: { + key: string; + value: DataRecordValue; + isMetric?: boolean; + }, clientX: number, clientY: number, ) => { @@ -383,7 +387,9 @@ export default function TableChart( }); onContextMenu(clientX, clientY, { drillToDetail: drillToDetailFilters, - crossFilter: getCrossFilterDataMask(cellPoint.key, cellPoint.value), + crossFilter: cellPoint.isMetric + ? undefined + : getCrossFilterDataMask(cellPoint.key, cellPoint.value), }); } : undefined; @@ -423,7 +429,7 @@ export default function TableChart( getValueRange(key, alignPositiveNegative); let className = ''; - if (emitCrossFilters) { + if (emitCrossFilters && !isMetric) { className += ' dt-is-filter'; } @@ -486,7 +492,7 @@ export default function TableChart( // show raw number in title in case of numeric values title: typeof value === 'number' ? String(value) : undefined, onClick: - emitCrossFilters && !valueRange + emitCrossFilters && !valueRange && !isMetric ? () => toggleFilter(key, value) : undefined, onContextMenu: (e: MouseEvent) => { @@ -495,7 +501,7 @@ export default function TableChart( e.stopPropagation(); handleContextMenu( row.original, - { key, value }, + { key, value, isMetric }, e.nativeEvent.clientX, e.nativeEvent.clientY, );