Monday, 9 September 2013

Jquery autucomplete UI

Jquery autucomplete UI

I am trying to populate JQUERY Autocomplete from the list. When I use
$.map(....) and pass it to 'response' function - it doesnt get populated
If I pass absolutely identical list (fakelst in the code below) - it
works. Why? They both seem to be absolutely idential arrays.
Does anybody know wherethe mistake is? I don't want to encumber the code
with extra array just to satisfy the weird behavior of the Autocomplete.
success: function (data) {
var lst = $.map(data.List, function (item) {
return {
label: item.Text,
value: item.Value
}
});
var fakelst = [
lst[0],
lst[1],
lst[2],
lst[3],
lst[4],
lst[5],
lst[6],
lst[7],
lst[8],
lst[9]
//{ label: 'AP1111', value: 'item1' },
//{ label: 'AP11123', value: 'item2' },
//{ label: "AP10112 - Avia Dec 11 - Turfnsurf", value:
"c2717261-80f5-4c81-8b4c-9e9c21b8f95f"},
//{ label: "AP10112", value: "xyz" }
];
response(fakelst); // work
//response(lst); // doesn't work
PS offtop) after the couple years of inactivity here I am deeply
disappointed to see the
ubiquitous stuff - mandatory registration with confirmation e-mail,
arbitrary password complexity and all this meddlesome stuff which we have
to see everywhere nowadays....

No comments:

Post a Comment