Debounce Search Panel on KendoGrid

1 Answer 364 Views
Data Source Grid
Alon
Top achievements
Rank 1
Veteran
Alon asked on 11 Dec 2022, 09:17 PM

Hi,

Love the search bar addition to the Kendo Grid. Thank you!

The underlying DataSource is set to serverFiltering = true and so I was wondering if it was possible to only begin the search once the user has entered 3 characters or more? The current behavior is that calls to the back end are made as soon as the user starts typing in the search bar but I wanted to see if there was a way to delay that until after the user enters 3 or more characters.

I guess I could achieve this by defining my own read method under the underlying DataSource transport but I wanted to see if there was a more elegant way to achieve this.

Regards,

1 Answer, 1 is accepted

Sort by
0
Georgi Denchev
Telerik team
answered on 14 Dec 2022, 12:40 PM

Hello, Alon,

The search bar does not have a minLength property so you'll have to implement some sort of custom logic to stop the filtering if less than 3 characters are present.

We have a KB article that showcases how to combine the Filter Menu and Search filters together(so that one does not override the other). This approach overrides the default search logic. You can extend it a bit and add a condition that prevents the filtering:

            if(value.length < 3 && value.length > 0) {
              return;
            }

Dojo

https://dojo.telerik.com/@gdenchev/uLaXIkaZ 

Best Regards,
Georgi Denchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Data Source Grid
Asked by
Alon
Top achievements
Rank 1
Veteran
Answers by
Georgi Denchev
Telerik team
Share this question
or