FWIW 6 个月后,我遇到了类似的事情......
在示例文件夹中有一个关于如何执行此操作的示例,该示例应与“display:false, viewColumns:false”协同工作。
https://github.com/gregnb/mui-datatables/blob/master/examples/customize-search/index.js
MUIDataTable 列:
...
{
"name":"hiddenCity",
"options":{
"filter":false,
"sort":false,
"display":false,
"viewColumns":false
}
},
{
"name":"hiddenState",
"options":{
"filter":false,
"sort":false,
"display":false,
"viewColumns":false
}
},
...etc...
MUIDataTable 选项:
let options = {
...lots of options...,
// Search ALL columns, including hidden fields that use display:false, viewColumns:false...
customSearch: (searchQuery, currentRow, columns) => {
let isFound = false;
currentRow.forEach(col => {
if (col && col.toString().indexOf(searchQuery) >= 0) {
isFound = true;
}
});
return isFound;
},
...more options...
}