I have a web api for address loopup. User can type some keywords and system will search both Location Description and Address.
I managed to write the following code to make it work, well, basically.
So, whenever user types anything, application will go to server to get back results properly.
However, since I need to specify dataTextField as LocationDescription, autocomplete will always filter out results if keyword is in Address field.
Default value of filter is startsWith, I've changed it to "contains" in my code.
My question is, is there any way I can just disable client side filtering based on dataTextField?
TIA
===============
<input id="pulocation" />
<script id="template" type="text/x-kendo-tmpl">
<b>${ data.LocationDescription }</b><br/>
${ data.Address }
</script>
<script type="text/javascript">
$(document).ready(function () {
var myDs = new kendo.data.DataSource({
transport: {
read: function (options) {
$.ajax({
url: "/api/AddressLookup",
data: {
criteria: function () {
return $("#pulocation").val();
}
},
success: function (result) {
options.success(result);
},
dataType: "json",
beforeSend: function (xhr) {
// set auth info
}
});
}
}
});
$("#pulocation").kendoAutoComplete({
minLength: 1,
dataTextField: "LocationDescription",
template: kendo.template($("#template").html()),
filter: "contains", // <--
dataSource: myDs
});
$("#pulocation").data("kendoAutoComplete").list.width(400);
$("#pulocation").keydown(function (e) {
myDs.read();
});
});
</script>
I managed to write the following code to make it work, well, basically.
So, whenever user types anything, application will go to server to get back results properly.
However, since I need to specify dataTextField as LocationDescription, autocomplete will always filter out results if keyword is in Address field.
Default value of filter is startsWith, I've changed it to "contains" in my code.
My question is, is there any way I can just disable client side filtering based on dataTextField?
TIA
===============
<input id="pulocation" />
<script id="template" type="text/x-kendo-tmpl">
<b>${ data.LocationDescription }</b><br/>
${ data.Address }
</script>
<script type="text/javascript">
$(document).ready(function () {
var myDs = new kendo.data.DataSource({
transport: {
read: function (options) {
$.ajax({
url: "/api/AddressLookup",
data: {
criteria: function () {
return $("#pulocation").val();
}
},
success: function (result) {
options.success(result);
},
dataType: "json",
beforeSend: function (xhr) {
// set auth info
}
});
}
}
});
$("#pulocation").kendoAutoComplete({
minLength: 1,
dataTextField: "LocationDescription",
template: kendo.template($("#template").html()),
filter: "contains", // <--
dataSource: myDs
});
$("#pulocation").data("kendoAutoComplete").list.width(400);
$("#pulocation").keydown(function (e) {
myDs.read();
});
});
</script>