how to reset mui-datatable filters?

43 Views Asked by At

I am creating a CRUD page, displaying the data through a server side mui-dataTable (paging, filtering, sorting, searching), when I apply filters and then create a new record I send a request to reset the filters, the problem The thing is that although the data is displayed correctly, the table still shows the labels of the old filters and I can't find a way to remove them: enter image description here

 const [parametersURL, setParametersURL] = useState({
    page: 1,
    rowsPerPage: 10,
    search: '',
    orderBy: '',
    orderDirection: '',
    filter: '',
    total: 0,
  })  




// mui-dataTable options:
 const options = {
    count: totalData,
    rowsPerPage: parametersURL.rowsPerPage,
    page: parametersURL.page - 1,
    serverSide: true,
   
    onChangePage: (currentPage) => {
      setParametersURL(prev => ({...prev, page: currentPage + 1}))
    },

    onChangeRowsPerPage: (numberOfRows) => {
      setParametersURL(prev => ({...prev, rowsPerPage: numberOfRows}))
    },

    onFilterChange: (changedColumn, filterList, a,columnIndex, displayData) => {
       // filter login you don't need to see
    }
} 



// and when the urlParameters changes the request is made
0

There are 0 best solutions below