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

fix(Table): the onFilter methods of column adds ability to filter children #47170

Merged
merged 1 commit into from Jan 27, 2024

Conversation

Mumujianguang
Copy link
Contributor

@Mumujianguang Mumujianguang commented Jan 26, 2024

[English Template / 英文模板]

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 工作流程
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

  1. Datasource children filtering #37972 ;

💡 需求背景和解决方案

  • 背景:column 配置中的 onFilter 方法只能过滤第一层数据,不能过滤 children 中的数据,导致在树形表格的场景中,onFilter 不能满足需求
  • 方案:在过滤逻辑中增加递归的处理逻辑

📝 更新日志

  • 在树形表格的场景下,编写 onFilter 的处理逻辑时,需要考虑子节点被匹配,但父节点 没有匹配上的情况,可参考如下示例
onFilter: (value: string, record) => {
  if (record.children && record.children.length) {
    return true;
  }
  return record.name.includes(value);
}
语言 更新描述
🇺🇸 英文 the onFilter methods of column adds ability to filter children
🇨🇳 中文 column配置中的 onFilter 方法增加过滤 children 的能力

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link

stackblitz bot commented Jan 26, 2024

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link
Contributor

github-actions bot commented Jan 26, 2024

Preview Is ready

Copy link
Contributor

github-actions bot commented Jan 26, 2024

Visual Regression Report for PR #47170 Passed ✅

Target branch: master (33b1aa0)


Congrats! No visual-regression diff found

Copy link

codesandbox-ci bot commented Jan 26, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a85aab6:

Sandbox Source
antd reproduction template (forked) Configuration

Copy link

codecov bot commented Jan 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (601d4db) 100.00% compared to head (a85aab6) 100.00%.
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #47170   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          732       732           
  Lines        12554     12557    +3     
  Branches      3294      3295    +1     
=========================================
+ Hits         12554     12557    +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@afc163 afc163 merged commit 25eda83 into ant-design:master Jan 27, 2024
62 checks passed
Copy link
Contributor

🎉 Thank you for your contribution! If you have not yet joined our DingTalk community group, please feel free to join us (when joining, please provide the link to this PR).

🎉 感谢您的贡献!如果您还没有加入钉钉社区群,请扫描下方二维码加入我们(加群时请提供此 PR 链接)。

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.

None yet

2 participants