I am experiencing two issues.
- Every time I type a character in the filter box at the top of any of my columns, my Ajax Read method ("_CustomBinding") is called 2 times. The first call populates the type ahead of the filter box, and the second one refreshes the grid. I do not want the grid to refresh until the enter key is pressed in the filter box, not on each key press. How do I disable the call to refresh the grid on every key press in the filter box?
- From the Kendo examples, I cannot find a way to differentiate between the Ajax Read call for populating the grid and populating the type ahead data in the filter boxes at the top of the columns. I need to be able to differentiate between these two uses for a couple of reasons.
- My grid performs all of the paging on the server. When I type into a column filter box, the call to the binding method includes the page number and page size. This causes my database query to limit the results to only records for the current page, which is not what I want. The auto fill should include values for all pages. I see in your online example that you do not apply paging at the database level, which is why it includes results across pages.
- If I were successful at ignoring the paging when fetching the type ahead data, it would pull back way too many records. I need to be able to differentiate between type ahead calls and ones for populating my grid data so that I can apply a distinct select for only the one column needed on my database query to properly fetch just the data needed for display in the type ahead, so I won’t have performance issues.
Please, advise me as to how I can overcome these issues. Thank you.
I have a very complicated Kendo Grid. Here is just part of it:
@(Html.Kendo().Grid<ProspectiveAdvantage.ViewModels.MemberListingModel>().Name("Members").TableHtmlAttributes(new { @class = "tblPatient" })
.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)));
columns.Bound(theMember => theMember.FirstName).Width(30).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").ShowOperators(false).MinLength(3).SuggestionOperator(FilterType.Contains)));
columns.Bound(theMember => theMember.DisplayClientMemberId).HeaderTemplate("Patient ID").Width(30).Filterable(ftb => ftb.Cell(cell => cell.Operator("contains").ShowOperators(false).MinLength(3).SuggestionOperator(FilterType.Contains)));
columns.Bound(theMember => theMember.DisplayBirthDate).HeaderTemplate("DOB").Format("{0:MM/dd/yyyy}").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("_CustomBinding", "PCPandCA").Data("members_FetchSearchParameters"))
.Events(events => events.Error("handleAjaxErrorFromGrid"))
.ServerOperation(true)
.PageSize(Model.PageSize).Model(model => { model.Id(e => e.MemberID); model.Field(f => f.FirstName); })
//default sort DisplaySignatureDue column by ascending
.Sort(sort => {
if (!AssessmentExpired) { sort.Add("DisplaySignatureDue").Ascending();}
if (AssessmentExpired) { sort.Add("DisplayExpiredDate").Ascending();}
})
)
.Pageable(pageable => pageable
.PageSizes(true)
.Refresh(true)
)
.Sortable()
.NoRecords("No records found.")
.Selectable()
.Filterable(ftb => ftb.Mode(GridFilterMode.Row))
.Events(events => events.Change("handleGridRowSelected").DataBinding("handleDataBinding").DataBound("handleDataBound").Filter("onFiltering"))
.HtmlAttributes(new { style = "cursor:pointer;border: 0px;height: 380px;display: flex;overflow-y: scroll;" })
)