fix(图表): 修复表格表头排序后点击获取的单元格数据错误 #8888

This commit is contained in:
wisonic-s 2024-04-03 15:50:02 +08:00
parent c25e5bc619
commit e391bd456e
3 changed files with 6 additions and 7 deletions

View File

@ -237,7 +237,6 @@ onMounted(() => {
/>
</el-form-item>
<el-form-item
:label="t('chart.table_show_index')"
class="form-item"
:class="'form-item-' + themes"
v-if="showProperty('tableHeaderSort')"

View File

@ -1,4 +1,4 @@
import { S2Event, S2Options, TableColCell, TableDataCell, TableSheet } from '@antv/s2'
import { S2Event, S2Options, TableColCell, TableDataCell, TableSheet, ViewMeta } from '@antv/s2'
import { formatterItem, valueFormatter } from '../../../formatter'
import { parseJson } from '../../../util'
import { S2ChartView, S2DrawOptions } from '../../types/impl/s2'
@ -143,13 +143,13 @@ export class TableInfo extends S2ChartView<TableSheet> {
// click
newChart.on(S2Event.DATA_CELL_CLICK, ev => {
const cell = newChart.getCell(ev.target)
const meta = cell.getMeta()
const meta = cell.getMeta() as ViewMeta
const nameIdMap = fields.reduce((pre, next) => {
pre[next['dataeaseName']] = next['id']
return pre
}, {})
const rowData = chart.data.tableRow[meta.rowIndex] as any
const rowData = newChart.dataSet.getRowData(meta)
const dimensionList = []
for (const key in rowData) {
if (nameIdMap[key]) {

View File

@ -1,5 +1,5 @@
import { S2ChartView, S2DrawOptions } from '@/views/chart/components/js/panel/types/impl/s2'
import { S2Event, S2Options, TableSheet, TableColCell } from '@antv/s2'
import { S2Event, S2Options, TableSheet, TableColCell, ViewMeta } from '@antv/s2'
import { parseJson } from '@/views/chart/components/js/util'
import { formatterItem, valueFormatter } from '@/views/chart/components/js/formatter'
import { copyContent, getCurrentField } from '@/views/chart/components/js/panel/common/common_table'
@ -139,13 +139,13 @@ export class TableNormal extends S2ChartView<TableSheet> {
// click
newChart.on(S2Event.DATA_CELL_CLICK, ev => {
const cell = newChart.getCell(ev.target)
const meta = cell.getMeta()
const meta = cell.getMeta() as ViewMeta
const nameIdMap = fields.reduce((pre, next) => {
pre[next['dataeaseName']] = next['id']
return pre
}, {})
const rowData = chart.data.tableRow[meta.rowIndex] as any
const rowData = newChart.dataSet.getRowData(meta)
const dimensionList = []
for (const key in rowData) {
if (nameIdMap[key]) {