Kendo Grid auto populate textbox using MVC .Filter event calling multiple time on key press

1 Answer 86 Views
Grid
AKULA
Top achievements
Rank 1
AKULA asked on 07 Feb 2022, 01:29 PM

 

How to restrict multiple key press events while entering characters in kendo grid auto populate text box
eg. If enter 3 characters in auto populate textbox its is hitting 3 times action method. How to avoid multiple
server action calls. Please find the pseudo code as below :

@(Html.Kendo().Grid<Model>().Name("Grid")
.AutoBind(Model.AutoPopulateResults)
.Columns(columns =>
{
columns.Bound(theMember => theMember.LastName).Width(30).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").ShowOperators(false).MinLength(3).SuggestionOperator(FilterType.Contains)));
}
.DataSource(dataBinding => dataBinding.Ajax()
.Read(read => read.Action("ActionMethod", "Controller").Data("SearchParameters"))
.Events(events => events.Error("handleAjaxErrorFromGrid"))
.ServerOperation(true)
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.Events(events => events.Change("GridRowSelected")
.Filter("GridRowonFiltering"))

 

 

 

1 Answer, 1 is accepted

Sort by
0
Eric
Top achievements
Rank 1
Veteran
Iron
answered on 09 Feb 2022, 03:00 PM

You can specify a Delay on the Filterable column, so it won't run the query until the user has paused typing for a time.

 

columns.Bound(theMember => theMember.LastName).Width(30)

.Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").ShowOperators(false).MinLength(3)

.Delay(1000).SuggestionOperator(FilterType.Contains)));


Tags
Grid
Asked by
AKULA
Top achievements
Rank 1
Answers by
Eric
Top achievements
Rank 1
Veteran
Iron
Share this question
or