I manged to make it work in a different way. It may not be an optimized way. but it works. the code is as follows:
self.productSource = function (query, response) {
var dataAdapter = new $.jqx.dataAdapter
(
{
localdata: getAllProductsAutoCompleteData(query, response),
datatype: "array"
},
{
autoBind: true,
formatData: function (data) {
data.name_startsWith = query;
return data;
}
}
);
};
function getAllProductsAutoCompleteData(query, response){
_productModel.getAllProductsAutoComplete(query, function(data){
if (data.length > 0) {
response($.map(data, function (item) {
return {
label: item.ProductName,
value: item.ProductName
}
}));
}
});
return [];
}
now the asynchronous method call works and auto complete values are coming properly to the jqxInput
Thanks,
Jitto P.Jose