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

🤔点击单元格中的icon,获取不到本行的数据,怎么可以点击图标获取当前行的数据 #2985

Open
5 tasks
dyllike3892654 opened this issue Nov 20, 2024 · 3 comments
Assignees
Labels
🐛 bug 这个是一个 bug next 2.0-next 版本的问题 ❔question 疑问/使用问题

Comments

@dyllike3892654
Copy link

🏷 Version

Package Version
@antv/s2 ^2.0.0-next.26
@antv/s2-react ^2.0.0-next.25
@antv/s2-vue

Sheet Type

使用的react中的透视表 SheetComponent 组件

  • PivotSheet
  • TableSheet
  • GridAnalysisSheet
  • StrategySheet
  • EditableSheet
  • [ √ ] SheetComponent

🖋 Description

我使用的是 @antv/s2-react 中的 SheetComponent 组件 ,给 表格 的 s2Options增加 配置 icon,使单元格的数据前增加一个icon图标,代码如下:
conditions: {
icon: [
// 配置数据单元格
{
field: 'number',
position: 'left',
mapping() {
return {
icon: 'CellUp',
fill: '#2498D1',
};
},
},
],
},

出现的问题是:当我点击单元格的时候可以获取到数据,但是当我单击到图标上时就会显示 undefined ;
image

使用 headerActionIcons 这个属性只能在角头、列头、行头显示
image

想达到的效果是:点击图标能获取当前行的数据

🔗 Reproduce Link

😊 Expected Behavior

😅 Current Behavior

@dyllike3892654 dyllike3892654 added the ❔question 疑问/使用问题 label Nov 20, 2024
@github-actions github-actions bot added the next 2.0-next 版本的问题 label Nov 20, 2024
@lijinke666 lijinke666 self-assigned this Nov 25, 2024
@lijinke666
Copy link
Member

lijinke666 commented Nov 25, 2024

可以先这样写, icon 是单元格的子节点, 所以没获取到 meta, 后续优化下

  onDataCellClick={({ event, target, viewMeta }) => {
    const meta = viewMeta || target?.parent?.meta
  }}

@lijinke666 lijinke666 added the 🐛 bug 这个是一个 bug label Nov 25, 2024
Copy link
Contributor

你好 @dyllike3892654,很抱歉给你带来了不好的体验, 我们会尽快排查问题并修复, 请关注后续发布日志.

Hello, @dyllike3892654, We are so sorry for the bad experience. We will troubleshoot and fix the problem as soon as possible. Please pay attention to the follow-up change logs.

@dyllike3892654
Copy link
Author

可以先这样写, icon 是单元格的子节点, 所以没获取到 meta, 后续优化下

  onDataCellClick={({ event, target, viewMeta }) => {
    const meta = viewMeta || target?.parent?.meta
  }}

好的感谢,辛苦了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug 这个是一个 bug next 2.0-next 版本的问题 ❔question 疑问/使用问题
Projects
None yet
Development

No branches or pull requests

2 participants