Skip to content

Commit

Permalink
Fix table chart's metrics columns
Browse files Browse the repository at this point in the history
  • Loading branch information
kgabryje committed Feb 23, 2023
1 parent 1029f36 commit 920ef20
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions superset-frontend/plugins/plugin-chart-table/src/TableChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,11 @@ export default function TableChart<D extends DataRecord = DataRecord>(
onContextMenu && !isRawRecords
? (
value: D,
cellPoint: { key: string; value: DataRecordValue },
cellPoint: {
key: string;
value: DataRecordValue;
isMetric?: boolean;
},
clientX: number,
clientY: number,
) => {
Expand All @@ -383,7 +387,9 @@ export default function TableChart<D extends DataRecord = DataRecord>(
});
onContextMenu(clientX, clientY, {
drillToDetail: drillToDetailFilters,
crossFilter: getCrossFilterDataMask(cellPoint.key, cellPoint.value),
crossFilter: cellPoint.isMetric
? undefined
: getCrossFilterDataMask(cellPoint.key, cellPoint.value),
});
}
: undefined;
Expand Down Expand Up @@ -423,7 +429,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
getValueRange(key, alignPositiveNegative);

let className = '';
if (emitCrossFilters) {
if (emitCrossFilters && !isMetric) {
className += ' dt-is-filter';
}

Expand Down Expand Up @@ -486,7 +492,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
// 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) => {
Expand All @@ -495,7 +501,7 @@ export default function TableChart<D extends DataRecord = DataRecord>(
e.stopPropagation();
handleContextMenu(
row.original,
{ key, value },
{ key, value, isMetric },
e.nativeEvent.clientX,
e.nativeEvent.clientY,
);
Expand Down

0 comments on commit 920ef20

Please sign in to comment.