【问题标题】:Dynamic Rendered Cell filter on Material Table材质表上的动态渲染单元格过滤器
【发布时间】:2021-10-29 00:10:38
【问题描述】:

在材料表库上,我正在尝试过滤自​​定义呈现的字段。官方文档没有任何自定义列渲染加过滤该列的示例。我曾尝试使用查找功能,但没有成功。

这里是官方文档:https://material-table.com/#/docs/features/filtering

这是一个实现:https://codesandbox.io/s/material-table---create-dinamic-object-to-lookup-forked-9px53?file=/src/index.js

我最好的选择是什么?

【问题讨论】:

    标签: reactjs material-table


    【解决方案1】:

    我发现customFilterAndSearch 字段可以帮助我解决这个问题。对于到达这里的人,为了解决问题,我在我的阵列上进行了快速搜索:

      customFilterAndSearch: (term, rowData) => {
              return rowData.lived.find((place) => {
                return place?.name?.toLowerCase().includes(term.toLowerCase());
              });
            }
    

    https://codesandbox.io/s/material-table---create-dinamic-object-to-lookup-forked-2ed1n?file=/src/index.js

    如果您认为我可以改进这一点,请告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-04-18
      • 1970-01-01
      • 2021-03-15
      • 1970-01-01
      • 2018-08-26
      • 2021-09-19
      • 2019-01-13
      • 2022-01-20
      相关资源
      最近更新 更多