Mui-datatables: Remote Search

Created on 9 Sep 2019  路  3Comments  路  Source: gregnb/mui-datatables

How can I handle Remote Search loading?

question

All 3 comments

By "remote," you mean with serverSide: true, right? If so, you have access to the search onChange function with onSearchChange which you can customize to call APIs and use debounce. If you want to change how any of the default searching works, you can also provide your own search bar with customSearchRender.

@gabrielliwerant I'm currently doing this and I'm trying to update a variable on the function using React Hooks but can't seem to make it work. The problem is by adding a React Hook inside the function, the search string parameter returns two separate string in alternating pattern (e.g. I press "a" and log shows "a", then press "s" then log shows "s", then "d" and log show "ad", then "f" and log shows "sf"). I'm already overriding the with the variable I'm using to save the search string. Removing the React Hook inside the function shows correct search string.

UPDATE: Found out I just need to update to the latest version. Thank you.

Hi @ksdelacruz Could you share a snippet of how you acheived ? I am using v2.13.3 and still having the same issue you have mentioned ,

onSearchChange:(searchKey) => {
            setTableState({...tableState,searchKey:searchKey});
        }
console.log(tableState.searchKey);

I am getting only one letter at a time on console.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gangakrishh picture gangakrishh  路  3Comments

pranavtheway picture pranavtheway  路  3Comments

aramkoukia picture aramkoukia  路  3Comments

krsandesh picture krsandesh  路  3Comments

naothomachida picture naothomachida  路  3Comments