Mui-datatables自定义搜索

问题描述 投票:0回答:1

如何在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个回答
0
投票

您可能正在寻找这样的东西: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

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

© www.soinside.com 2019 - 2024. All rights reserved.