Material-table: Search data in table on press enter

Created on 21 Sep 2019  路  9Comments  路  Source: mbrn/material-table

Hi, how can i overwrite the search functionality in table instead of sending an API call on key press i want to send an API call on press Enter.
How can i do this ?

I am using debounceInterval: 2000 but this is not enough can i overwrite this function to call on enter key ?

enhancement

Most helpful comment

@mbrn another candidate for overriding - Search component.

All 9 comments

Also looking to start search on Enter keypress and looking for some examples on how to access the search field to do this.

I was not able to figure out to use the default search input field to initiate search on Enter so I added a separate TextField and used the option toolbar: false, to hide the toolbar (search input, title, etc.). I used tableRef following this post[1] to query the data with the text in the TextField.

[1] https://github.com/mbrn/material-table/issues/383

I was not able to figure out to use the default search input field to initiate search on Enter so I added a separate TextField and used the option toolbar: false, to hide the toolbar (search input, title, etc.). I used tableRef following this post[1] to query the data with the text in the TextField.

[1] #383

Thanks @twhetzel can you please share the code here.

@mbrn another candidate for overriding - Search component.

Found the solution and i think it's a best solution and this is exactly what i want . 馃憤 .
I have just overwrite the component and add input field in Material table header like below and it's work like a charm.
image

Just used display none css property to hide default search field. Hacky way but works.

Just change the functionality of search field and pass query.search through another function on press Enter after type no need to use **debounceInterval**

Custom search field with remote data......
image

@iqasim-com Can you please share sample code? Thank you!

Found the solution and i think it's a best solution and this is exactly what i want . 馃憤 .
I have just overwrite the component and add input field in Material table header like below and it's work like a charm.
image

Just used display none css property to hide default search field. Hacky way but works.

Just change the functionality of search field and pass query.search through another function on press Enter after type no need to use **debounceInterval**

Custom search field with remote data......
image

Works for me!, Thanks @iqasim-com!!

@dr-martin @iqasim-com could u please share ur code ?

@dr-martin @iqasim-com can you please share your code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kfirshahar picture kfirshahar  路  3Comments

bohrsty picture bohrsty  路  3Comments

terapepo picture terapepo  路  3Comments

roseak picture roseak  路  3Comments

revskill10 picture revskill10  路  3Comments