Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🤔树状透视表 子节点无数据时,展开折叠按钮不显示? #2981

Closed
1 of 5 tasks
db-shuai opened this issue Nov 19, 2024 · 1 comment
Closed
1 of 5 tasks
Assignees
Labels
next 2.0-next 版本的问题 ❔question 疑问/使用问题

Comments

@db-shuai
Copy link

db-shuai commented Nov 19, 2024

🏷 Version

Package Version
@antv/s2 2.0.0-next.32
@antv/s2-react
@antv/s2-vue 2.0.0-next.16

Sheet Type

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet

🖋 Description

当我尝试将 S2 表格从 [email protected] 升级至 [email protected][email protected]升级至[email protected]
发现在树状模式下 hierarchyType:tree ,若子节点无数据父节点不展示 折叠与展开按钮了,因以前是通过点击折叠按钮获取子节点数据的。所以想咨询一下目前怎么配置可以使展开折叠按钮一直显示?

🔗 Reproduce Link

https://codesandbox.io/p/sandbox/async-leaf-fmt353

😊 Expected Behavior

image

😅 Current Behavior

image
@db-shuai db-shuai added the ❔question 疑问/使用问题 label Nov 19, 2024
@github-actions github-actions bot added the next 2.0-next 版本的问题 label Nov 19, 2024
@lijinke666
Copy link
Member

lijinke666 commented Nov 25, 2024

若子节点无数据父节点不展示 折叠与展开按钮了

之前的版本能展示是 bug, 叶子节点不展示符合预期.

因以前是通过点击折叠按钮获取子节点数据的。所以想咨询一下目前怎么配置可以使展开折叠按钮一直显示?

可以自定义 rowCell, 重写 默认 icon 的展示规则, 比如第一层级始终展示

class CustomRowCell extends RowCell {
  showTreeIcon() {
    return (
      this.spreadsheet.isHierarchyTreeType() &&
      (!this.meta.isLeaf || this.meta.level === 0)
    );
  }
}

const s2Options = {
  rowCell: (node, spreadsheet, headerConfig) => {
    return new CustomRowCell(node, spreadsheet, headerConfig);
  }
}

@lijinke666 lijinke666 self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next 2.0-next 版本的问题 ❔question 疑问/使用问题
Projects
None yet
Development

No branches or pull requests

2 participants