【问题标题】:Mui-datatables custom searchMui-datatables 自定义搜索
【发布时间】:2020-09-26 03:20:58
【问题描述】:

如何在 mui-datatables 中添加自定义搜索,可用于从 API 获取的数据。你能给我一个工作的例子吗?我尝试使用

 customSearch: (searchQuery, currentRow, columns) => {
    let isFound = false;
    currentRow.forEach(col => {
      if (col.toString().indexOf(searchQuery) >= 0) {
        isFound = true;
      }
    });
    return isFound;
  },

在选项中。

注意:在控制台中,我得到了 react_devtools_backend.js:6 服务器端过滤已启用,因此将忽略自定义搜索。

【问题讨论】:

    标签: reactjs material-ui mui-datatable


    【解决方案1】:

    您可能正在寻找这样的东西: https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-filters/index.js

    或者这个(debounceSearchRender 插件): https://github.com/gregnb/mui-datatables/blob/master/examples/large-data-set/index.js

    您的后端将返回结果,因此需要在服务器中定义您的自定义搜索。

    【讨论】:

      猜你喜欢
      • 2021-01-06
      • 1970-01-01
      • 2021-07-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-14
      • 2018-04-19
      • 1970-01-01
      相关资源
      最近更新 更多