I have an ajax form in a window widget and on this form I have 4 Kendo AutoComplete widgets configured using the AutoCompletFor() method. The widgets are working correctly as far as suggesting and filtering against an MVC action, etc. I placed a button on my form to allow the user to quickly clear all of the values from the form:
Here is the button code:
Here is the code for one of the AutoComplete Widgets:
Here is the javascript function in my javascript file to set the value to null:
The interesting thing is that when I first open the Window widget and display the form, the user can type into the autocomplete and then click the reset button and it clears the values and the placeholder value returns. If, however, they submit the form using a "save" method, and then click the "Reset" button, nothing happens. The function is called (I placed alerts inside). If I set the value to something other than null for instance (#field).data("KendoAutoComplete").value("some value"), the value changes, but not if I set it to null, or empty string.
Any help would be appreciated. Is this a bug or am I doing something incorrect?
Here is the button code:
<
input
onClick
=
"resetOptionsQuery();"
type
=
button
value
=
"Reset Query"
/>
Here is the code for one of the AutoComplete Widgets:
@(Html.Kendo().AutoComplete()
.Name("OptionQueryApplication")
.Placeholder("Select a default application...")
.DataTextField("Value")
.Filter("contains")
.HtmlAttributes(new { style = "width:250px" })
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetFilteredApplicationNameList", "ErrorLog")
.Data("onGetDefaultApplication");
}).ServerFiltering(true);
}))
Here is the javascript function in my javascript file to set the value to null:
function resetOptionsQuery() {
$("#OptionQueryApplication").data("kendoAutoComplete").value(null);
$("#OptionQueryMachine").data("kendoAutoComplete").value(null);
$("#OptionQueryEnvironment").data("kendoAutoComplete").value(null);
$("#OptionQueryUser").data("kendoAutoComplete").value(null);
}
The interesting thing is that when I first open the Window widget and display the form, the user can type into the autocomplete and then click the reset button and it clears the values and the placeholder value returns. If, however, they submit the form using a "save" method, and then click the "Reset" button, nothing happens. The function is called (I placed alerts inside). If I set the value to something other than null for instance (#field).data("KendoAutoComplete").value("some value"), the value changes, but not if I set it to null, or empty string.
Any help would be appreciated. Is this a bug or am I doing something incorrect?