Hi
I am using the @Html.Kendo.DropDownList in a MVC application (.NET Core). The code works perfectly. I have a weird request though. I get my data from a backend system which cannot filter any fields that are less than 1001 entries long (long story but unfortunately true) - so this is what happens: the page loads and then calls source.read to get the first 1001 entries - this works perfectly each time. If the user then does as typeahead search in a field that is < 1001 entries the search does not work i.e. the DB returns all the entries again. If there are more that 1001 entries all is well. My question is this: is there a way for me to change the
.ServerFiltering(true);
to
.ServerFiltering(false);
at runtime?
My idea is that once the initial data has been loaded I check how many entries have been received and then set the .ServerFiltering flag appropriately.
Alternatively I could load all the dropdown first (before showing the page) and then have an if statement on the .cshtml file => this would/has worked but it experience is worse for the users - using ServerFiltering (true) loads the page and the users see the spinning blue thingy and know that data is being loaded (I can have up to 100 dropdown on the page (the users decide how many per page themselves)), otherwise, once they have pressed open they need to wait while the dropdown are being loaded.
Thank you in advance for any help given.
Ursus
@(Html.Kendo().DropDownList()
.Name(kendoFieldName)
.MinLength(3)
.Value(Model.Fields[i].Values[j])
.HtmlAttributes(new {style = "width: 100%"})
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("TypeAhead", "Document", new
{
docId = Model.DocId,
docType = Model.DocType,
fieldNumber = Model.Fields[i].FieldIndex,
row = j
});
})
.ServerFiltering(true);
})
)