[Bug] 透视表树形表格使用extensionRows的场景,对extensionRows树节点做收起展开操作后,调用getCellAddressByHeaderPaths方法获取的单元格row行索引错误,永远都是0
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
Version
1.17.3
Link to Minimal Reproduction
none
Steps to Reproduce
const option = {
records: [],
rows: [
{
dimensionKey: 'DATA_TYPE',
title: '数据类型',
width: 'auto',
minWidth: 100,
sort: true,
showSort: false,
showSortInCorner: false,
headerStyle: {
textStick: false,
fontSize: 12,
color: 'rgba(17, 25, 37, 0.85)'
}
}
],
rowTree: [
{
dimensionKey: 'DATA_TYPE',
value: '测试1'
},
{
dimensionKey: 'DATA_TYPE',
value: '测试2'
}
],
extensionRows: [
{
rows: [
{
dimensionKey: 'dim_0f3fd7af',
title: 'test1/test2',
width: 'auto',
minWidth: 100,
sort: true,
showSort: false,
showSortInCorner: false,
headerStyle: {
textStick: false,
fontSize: 12,
color: 'rgba(17, 25, 37, 0.85)'
}
},
{
dimensionKey: 'dim_6dd5f4b5',
title: 'test2',
width: 'auto',
minWidth: 100,
sort: true,
showSort: false,
showSortInCorner: false,
headerStyle: {
textStick: false,
fontSize: 12,
color: 'rgba(17, 25, 37, 0.85)'
}
}
],
rowTree: [
{
dimensionKey: 'dim_0f3fd7af',
value: 'value1',
children: [
{
dimensionKey: 'dim_6dd5f4b5',
value: 'value1-1',
children: [],
hierarchyState: 'expand'
},
{
dimensionKey: 'dim_6dd5f4b5',
value: 'value1-2',
children: [],
hierarchyState: 'expand'
},
{
dimensionKey: 'dim_6dd5f4b5',
value: 'value1-3',
children: [],
hierarchyState: 'expand'
}
],
hierarchyState: 'expand'
},
{
dimensionKey: 'dim_0f3fd7af',
value: 'value2',
children: [
{
dimensionKey: 'dim_6dd5f4b5',
value: 'value2-1',
children: [],
hierarchyState: 'expand'
}
],
hierarchyState: 'expand'
},
{
dimensionKey: 'dim_0f3fd7af',
value: '列小计',
children: []
}
]
}
],
indicators: [
{
indicatorKey: 'DATE_DIM_0_0',
title: '2025-03',
width: 'auto',
sort: true,
showSort: true,
headerStyle: {
fontWeight: 'normal',
color: 'rgba(17, 25, 37, 0.85)'
},
style: {
textAlign: 'right',
padding: [8, 12, 8, 12],
fontSize: 12
}
}
],
frozenColCount: 3,
rowExpandLevel: null,
rowHierarchyType: 'tree',
rowHierarchyIndent: 12,
rowHierarchyTextStartAlignment: true,
defaultRowHeight: 28,
defaultHeaderRowHeight: 34,
autoFillWidth: true
}
const instance = new VTable.PivotTable(document.getElementById(CONTAINER_ID), option)
instance.on('click_cell', (params) => {
console.log(
'params',
params,
instance.getCellHeaderPaths(params.col, params.row),
instance.getCellAddressByHeaderPaths({
colHeaderPaths: params.cellHeaderPaths.colHeaderPaths,
rowHeaderPaths: params.cellHeaderPaths.rowHeaderPaths
})
)
})
window.tableInstance = instance
https://visactor.io/vtable/demo/table-type/pivot-table-multi-tree 可以把上面那段代码复制到这个示例里,对任意行表头单元格做展开收起操作,观察前后console.log日志打印的航索引信息变化
Current Behavior
只要不做收起操作就能拿到正确的行索引,一旦做了收起操作,后续无论是否重新展开,取到的行索引都会有问题
Expected Behavior
展开收起操作前后,行索引都能正常获取
Environment
- OS:
- Browser:
- Framework:
Any additional comments?
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the minimal reproduction in the issue and the getCellAddressByHeaderPaths and getCellHeaderPaths entry points. Reproduce the extensionRows tree collapse and expand sequence in the linked pivot-table demo, then trace how row header paths are converted to indices. Done means the returned row index remains correct before and after collapsing and expanding any row header.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100