forked from github/dataease
Merge pull request #4169 from dataease/pr@dev@feat_table_pivot
feat(视图): 透视表增加表头行列点击事件
This commit is contained in:
commit
9ad2faa99a
@ -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)
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user