Merge pull request #9498 from dataease/pr@dev@fix_table_scroll_column_resize

fix(视图): 修复表格滚动时改变列宽表格会错位 #8810
This commit is contained in:
wisonic-s 2024-05-06 17:10:36 +08:00 committed by GitHub
commit a4aa7eea3b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 8 deletions

View File

@ -230,9 +230,7 @@ export function baseTableInfo(container, chart, action, tableData, pageInfo, vue
// right click
s2.on(S2Event.GLOBAL_CONTEXT_MENU, event => copyContent(s2, event, meta))
// column resize
if (size.tableColumnMode === 'field') {
s2.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, event => resizeFunc(event))
}
s2.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, event => resizeFunc(event))
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })
@ -436,9 +434,7 @@ export function baseTableNormal(container, chart, action, tableData, vueCom, res
// right click
s2.on(S2Event.GLOBAL_CONTEXT_MENU, event => copyContent(s2, event, meta))
// column resize
if (size.tableColumnMode === 'field') {
s2.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, event => resizeFunc(event))
}
s2.on(S2Event.LAYOUT_RESIZE_COL_WIDTH, event => resizeFunc(event))
// theme
const customTheme = getCustomTheme(chart)
s2.setThemeCfg({ theme: customTheme })

View File

@ -577,12 +577,18 @@ export default {
this.remarkCfg = getRemark(this.chart)
},
columnResize(resizeColumn) {
//
this.myChart.facet.timer?.stop()
this.$nextTick(this.initScroll)
if (!this.inScreen) {
// /
// /
return
}
const size = JSON.parse(this.chart.customAttr).size
if (size.tableColumnMode !== 'field') {
return
}
const fieldId = resizeColumn.info.meta.field
const size = JSON.parse(this.chart.customAttr).size
const containerWidth = document.getElementById(this.chartId).offsetWidth
const column = size.tableFieldWidth?.find(i => i.fieldId === fieldId)
let tableWidth