I'm using the Kendo combobox on a edit form. I'm loading initial values into the comboboxes on page load by using the "value" and "text" properties. I have autobind set to false. If I click the "clear" button it doesn't actually clear out the text value until the second time I click it. It looks like the first time I click clear it loads the actual data items and then selects the value I have it set to. The second time I click clear it actually works. What is the proper way to configure this to load values from the server and preload a specific item when the control initializes?
@(Html.Kendo().ComboBox()
.Name("combo" + item.DataField.ID)
.Filter("contains")
.DataTextField("DataTextField")
.DataValueField("DataTextValue")
.Placeholder("Select an item...")
.AutoBind(false)
.ClearButton(true)
.DataSource(source =>
{
source.Custom()
.ServerFiltering(true)
.ServerPaging(true)
.PageSize(40)
.Type("aspnetmvc-ajax") //Set this type if you want to use DataSourceRequest and ToDataSourceResult instances
.Transport(transport =>
{
transport.Read(r =>
{
r.Action("Virtualization_ReadComboEdit3", "Search", new { dataFieldId = item.DataField.ID }).Type(HttpVerbs.Post).Data("getFormData");
});
})
.Schema(schema =>
{
schema.Data("Data") //define the [data](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.data) option
.Total("Total"); //define the [total](https://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.total) option
});
})
.HtmlAttributes(new { style = "width:100%;", data_parent_id = (item.DataField.ParentDataFieldID!=null ? item.DataField.ParentDataFieldID.ToString() : ""), data_conditional = item.DataField.IsConditionListener })
.FooterTemplate("<b>#: instance.dataSource.total() # items found<b/>")
.Events(e =>
{
e.Select("onSelectCombo");
e.Open("onOpenCombo");
e.Change("onChangeCombo");
})
.Virtual(v =>
{
v.MapValueTo("dataItem");
v.ItemHeight(26);
v.ValueMapper(e => "function(options) { dropdownMapper(options," + item.DataField.ID + "); }");
})
.Value(item.DataField.CurrentFieldValueSingle.ToString())
.Text(item.DataField.CurrentFieldText)
)