gregnb / mui-datatables

Datatables for React using Material-UI
MIT License
2.71k stars 932 forks source link

Search is not working #1643

Open seacrest07 opened 3 years ago

seacrest07 commented 3 years ago

Keyword search is not possible when the server option is set to true.

Expected Behavior

The rows containing the keyword should be visible

Current Behavior

The rows are not filtered according to the searched keyword.

Steps to Reproduce (for bugs)

Here's my mui data-table configuration const options = { page: page, rowsPerPage: rowsPerPage, count: count, serverSide: true, filter: true, filterType: "dropdown", responsive: 'vertical', tableBodyHeight: "550px", onTableChange: (action, tableState) => { console.log(tableState); console.log("action ==> ",action); if(action === "changePage" || action === "changeRowsPerPage"){ this.changePage(tableState.page, tableState.rowsPerPage); } }

Tech Version
Material-UI ^4.11.3
MUI-datatables ^3.7.4
React 17.0.1
wdh2100 commented 3 years ago

using

onSearchChange function   Callback function that triggers when the search text value has changed. function(searchText: string) => void

ref : https://github.com/gregnb/mui-datatables/blob/master/examples/serverside-filters/index.js

seacrest07 commented 3 years ago

Thanks for the response. Just wanted to know that keyword search will not work for serverSide:true Like it worked for the static data.

wdh2100 commented 3 years ago

Like it worked for the static data.

Yes, search does not work if serverside = true. But using the onSearchChange function you can implement the same.

wdh2100 commented 3 years ago

ref : https://github.com/gregnb/mui-datatables/issues/1037, https://github.com/gregnb/mui-datatables/issues/1624