Merge pull request #4169 from dataease/pr@dev@feat_table_pivot

feat(视图): 透视表增加表头行列点击事件
This commit is contained in:
Junjun 2022-12-22 18:00:27 +08:00 committed by GitHub
commit 9ad2faa99a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 2 deletions

View File

@ -301,7 +301,7 @@ export function baseTableNormal(s2, container, chart, action, tableData) {
return s2
}
export function baseTablePivot(s2, container, chart, action, tableData) {
export function baseTablePivot(s2, container, chart, action, headerAction, tableData) {
const containerDom = document.getElementById(container)
// row and column
@ -476,6 +476,8 @@ export function baseTablePivot(s2, container, chart, action, tableData) {
// click
s2.on(S2Event.DATA_CELL_CLICK, action)
s2.on(S2Event.ROW_CELL_CLICK, headerAction)
s2.on(S2Event.COL_CELL_CLICK, headerAction)
// theme
const customTheme = getCustomTheme(chart)

View File

@ -308,7 +308,7 @@ export default {
} else if (chart.type === 'table-normal') {
this.myChart = baseTableNormal(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
} else if (chart.type === 'table-pivot') {
this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableData)
this.myChart = baseTablePivot(this.myChart, this.chartId, chart, this.antVAction, this.tableHeaderClick, this.tableData)
} else {
if (this.myChart) {
this.antVRenderStatus = false
@ -368,6 +368,16 @@ export default {
this.$refs.viewTrack.trackButtonClick()
}
},
tableHeaderClick(param) {
const cell = this.myChart.getCell(param.target)
const meta = cell.getMeta()
const rowData = meta.query
// rowData is a object,do something
// {
// city:"",
// province:""
// }
},
setBackGroundBorder() {
if (this.chart.customStyle) {
const customStyle = JSON.parse(this.chart.customStyle)