So this is the response I get from my web service
{"suggestions":["123","1231","1232","1233","1234","1235","1236","1237","1238","1239","12333","12334","12335","12335","12336","12337","12339","12340","12341","12342","12343","12344","12345","12346","12347","12348","12349"]}
And yours is:
[{"texto":"Arroio Areal"},{"texto":"Arroio Arenal"},{"texto":"Arroio Baje"},{"texto":"Arroio Bolacha"},{"texto":"Arroio Candiota"},{"texto":"Arroio Caracá"},{"texto":"Arroio Castelhano"},{"texto":"Arroio Cavera"},{"texto":"Arroio Chico Loma"},{"texto":"Arroio Chuí"},{"texto":"Arroio da Pintada"},{"texto":"Arroio das Lavras"},{"texto":"Arroio Del Rei"},{"texto":"Arroio Do Bote"},{"texto":"Arroio dos Ratos"},{"texto":"Arroio Francisco Alves"},{"texto":"Arroio Garupa"},{"texto":"Arroio Grande"},{"texto":"Arroio Ibacuru"},{"texto":"Arroio Ibirocai"},{"texto":"Arroio Jacaré"},{"texto":"Arroio Jaguarão-Chico"},{"texto":"Arroio João Dias"},{"texto":"Arroio Não Sabia"},{"texto":"Arroio Pelotas"},{"texto":"Arroio Pequiri"},{"texto":"Arroio Petim"},{"texto":"Arroio Pinhal"},{"texto":"Arroio Pirai"},{"texto":"Arroio Portão"},{"texto":"Arroio Ribeiro"},{"texto":"Arroio Ribeiro Pequeno"},{"texto":"Arroio Saicã"},{"texto":"Arroio São Lourenço"},{"texto":"Arroio Sutil"},{"texto":"Arroio Taquara"},{"texto":"Arroio Taquarembozinho"},{"texto":"Arroio Telho"},{"texto":"Arroio Vacaquá"},{"texto":"Arroio Velhaco"},{"texto":"Arroio Vira Carreta"},{"texto":"Lagoa dos Barros"},{"texto":"Rio Carreiro"}]
The BIG difference is you are returning an array of objects and mine is returning an object that has a property containing an array of strings...
So in the def.then of my code I am doing
array.map(resp.suggestions, lang.hitch(this, function(val){
iterating through the resp.suggestions (where resp is an object and suggestions is a property of that object and is an array). In your case it would be more like:
array.map(resp, lang.hitch(this, function(val){
var item = new MenuItem({
label: val.texto,
onClick: lang.hitch(this, function (evt) {
...