Skip to content

Commit 6d29f53

Browse files
committed
fix(table): return casesesitive raw data when cell click or sort by column, issue #869
1 parent da6bd49 commit 6d29f53

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

frontend/src/app/components/ChartGraph/BasicTableChart/BasicTableChart.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,20 @@ class BasicTableChart extends ReactChart {
652652
uid: c.uid,
653653
};
654654
},
655-
onCell: (record, rowIndex) => {
655+
onCell: (_, rowIndex) => {
656656
const row = chartDataSet[rowIndex];
657657
const cellValue = row.getCell(c);
658+
const rawData = { [chartDataSet.getFieldOriginKey(c)]: cellValue };
658659
return {
659660
uid: c.uid,
660661
cellValue,
661662
dataIndex: row.getFieldKey(c),
662663
...this.registerTableCellEvents(
663-
row.getFieldKey(c),
664+
colName,
664665
cellValue,
665666
rowIndex,
666-
record,
667+
rawData,
668+
c.aggregate,
667669
),
668670
};
669671
},
@@ -905,13 +907,15 @@ class BasicTableChart extends ReactChart {
905907
value: any,
906908
dataIndex: number,
907909
record: any,
910+
aggOperator?: string,
908911
) {
909912
const eventParams = this.createrEventParams({
910913
seriesType: 'body',
911914
name: seriesName,
912915
data: {
913916
format: undefined,
914917
name: seriesName,
918+
aggOperator,
915919
rowData: record,
916920
value: value,
917921
},

frontend/src/app/components/ChartGraph/models/ChartDataSet.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ class ChartDataSetBase extends Array {
4545
return this.toCaseInsensitive(getValueByColumnKey(field));
4646
}
4747

48+
protected toOriginKey(field: ChartDataSectionField): string {
49+
return getValueByColumnKey(field);
50+
}
51+
4852
protected createColumnIndexTable(metas?: ChartDatasetMeta[]): {
4953
[key: string]: number;
5054
} {
@@ -83,6 +87,10 @@ export class ChartDataSet<T>
8387
return this.toKey(field);
8488
}
8589

90+
public getFieldOriginKey(field: ChartDataSectionField) {
91+
return this.toOriginKey(field);
92+
}
93+
8694
public getFieldIndex(field: ChartDataSectionField) {
8795
return this.toIndexBy(this.columnIndexTable, field);
8896
}

0 commit comments

Comments
 (0)