Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 22, 2026

Solve the issue and close #3204

columns 为自定义列头配置(对象数组)时,行维度按 TOTAL_VALUE 排序失效。原因是排序逻辑中直接使用 includes()indexOf() 检查字段是否存在于 rows/columns 数组,字符串与对象比较始终返回 false/-1。

修改内容

  • sort-action.ts: sortByFuncsortByMethodcreateTotalParamsgetSortByMeasureValues 中的字段检查逻辑
  • pivot-data-set.ts: handlePivotMetaSort 中的行/列字段判断
  • spread-sheet.ts: getTotalsConfig 中的行字段判断

所有修改统一使用 getLeafColumnsWithKey() 将自定义列头转换为字符串数组后再进行检查。

示例

// 自定义列头配置(对象数组)
fields: {
  rows: ['商品大类', '品牌'],
  columns: [{ field: '所有量值[实际销售数量]', title: '实际销售数量' }],
  values: ['所有量值[实际销售数量]']
}

// 原代码:columns.indexOf(sortFieldId) 返回 -1
// 修复后:getLeafColumnsWithKey(columns).indexOf(sortFieldId) 正确返回索引
Original prompt

分析issue #3204 是否是本仓库的代码bug,如果是,请进行修复,并解释修复思路。最终提交的PullRequest的标题和描述都应该是中文的。Pull Request的描述中需要Solve the issue and close #3204


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: Alexzjt <9548248+Alexzjt@users.noreply.github.com>
Copilot AI changed the title [WIP] 修复代码问题,解决#3204 fix: 修复透视表自定义列头后行维度外侧排序失效的问题 Jan 22, 2026
Copilot AI requested a review from Alexzjt January 22, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛透视表自定义列头后,行维度的外侧排序失效

2 participants