I've defined a combobox this way:
But I have two problems:
- if the data returned by GetSites is empty, this GetSites method is then called endlessly (I see that in firebug, it's like an infinite loop)
- if I return data filtered by the text typed by the user, then the GetSites method is never called again when he types something else
Thanks in advance
$(document).ready(
function
() {
cboSite = $(
"#SiteId"
).kendoComboBox({
minLength: 2,
suggest:
true
,
autoBind:
false
,
dataTextField:
"text"
,
dataValueField:
"value"
,
dataSource: {
serverFiltering:
true
,
serverPaging:
true
,
datatype:
'json'
,
transport: {
read: {
url:
'@Url.Action("GetSites", "Equipment", new { area = "Equipment" })'
,
data: {
q:
function
() {
return
cboSite.text();
}
}
}
}
,
schema: {
data:
function
(data) {
return
data.result;
}
}
}
}).data(
"kendoComboBox"
);
});
But I have two problems:
- if the data returned by GetSites is empty, this GetSites method is then called endlessly (I see that in firebug, it's like an infinite loop)
- if I return data filtered by the text typed by the user, then the GetSites method is never called again when he types something else
Thanks in advance