Is is possible to configure the GridSearchBox in the TelerikGrid Toolbar, so that it searches when the user presses ENTER/RETURN instead of after every key press?
1 Answer, 1 is accepted
0
Dimo
Telerik team
answered on 09 Mar 2023, 08:51 AM
Hello Rob,
Currently, the GridSearchBox always triggers search during typing. You have two options:
Unfortunately, I cannot replace the GridSearchBox as that is an internal component to your library, which gives it access to internal features of the Grid. Specifically the CommandName of the TableCommandEventArgs class.
In replacing the text box, we lose all the integrated functionality for filtering/sorting that the GridSearchBox provides, with no way to reproduce them.
Regards, Rob
Dimo
Telerik team
commented on 09 Mar 2023, 03:48 PM
@Rob - the "access to intenal features" is a bit over-stated. The GridSearchBox helps build filter descriptors for the SearchFilter property of the Grid state. These filter descriptors are then used in the Grid data request. This routine is exactly what the second link shows how to implement manually.
So it is possible to replace the default search box component without losing functionality. You can even mimic the HTML rendering with the icons if you like.
Why do you need the TableCommandEventArgs CommandName?
I am incredibly happy using the GridSearchBox to automatically find columns or optionally take a list of columns to search on. This is exactly the functionality I want to use. Only I would like it triggered by an Enter key rather than automatically after key presses.
The link you provided is very good at implementing this for one use case and I am sure with some tweaking I could make it work in a more generic manner.
My initial investigation into this issue lead into the source for the Telerik Grid to see how it is being done at the moment. I was hoping to extend the existing functionality with wrappers the Telerik editions.
if we have to do it as part of the OnRead event, then so be it.