I'm using Kendo UI AutoComplete linked up to a Web Method. It works great.
What I am trying to do now is to have a link on the page and when clicked it will populate the autocomplete input value and then refresh the datasource based on that value.
I can easily populate the autocomplete value with $("#search_input").data("kendoAutoComplete").value(name); However, the data does not refresh when I do this, it still has the resultset from the previous search. How can an invoke the AutoComplete to behave as if I typed in the new value, so that the datasource result set refreshes based on the new input value?
$("#search_input").kendoAutoComplete({
minLength: 1,
dataSource:
{
serverFiltering: true,
serverPaging: true,
pageSize: 20,
transport:
{
read:
{
url: "Default.aspx/GetSearchAutoComplete",
data: function () {
return { Param: $("#search_input").data("kendoAutoComplete").value() };
},
contentType: 'application/json; charset=utf-8',
type: 'POST',
dataType: 'json'
},
parameterMap: function (options) {
return kendo.stringify(options);
}
},
schema:
{
data: function (data) {
searchData = data.d
return data.d;
}
}
},
dataTextField: "Name",
dataValueField: "Id"
select: function (e) {
searchSelectedIndex = e.item.index();
SearchSelect();
}
});
What I am trying to do now is to have a link on the page and when clicked it will populate the autocomplete input value and then refresh the datasource based on that value.
I can easily populate the autocomplete value with $("#search_input").data("kendoAutoComplete").value(name); However, the data does not refresh when I do this, it still has the resultset from the previous search. How can an invoke the AutoComplete to behave as if I typed in the new value, so that the datasource result set refreshes based on the new input value?
$("#search_input").kendoAutoComplete({
minLength: 1,
dataSource:
{
serverFiltering: true,
serverPaging: true,
pageSize: 20,
transport:
{
read:
{
url: "Default.aspx/GetSearchAutoComplete",
data: function () {
return { Param: $("#search_input").data("kendoAutoComplete").value() };
},
contentType: 'application/json; charset=utf-8',
type: 'POST',
dataType: 'json'
},
parameterMap: function (options) {
return kendo.stringify(options);
}
},
schema:
{
data: function (data) {
searchData = data.d
return data.d;
}
}
},
dataTextField: "Name",
dataValueField: "Id"
select: function (e) {
searchSelectedIndex = e.item.index();
SearchSelect();
}
});