Not able to assign array to global array

8 views
Skip to first unread message

ud...@sweetcouch.com

unread,
Dec 9, 2016, 9:42:15 AM12/9/16
to Dexie.js
SC.ACHelper.getFilterDict = function(st_split){

var data = [];

for(var i=0;i<st_split.length;i++){
for(var j=0;j<10;j++){
SC.ACHelper.IDB.sc_search_new.where('kn'+j).startsWithIgnoreCase(st_split[i]).toArray(function(result){
if(result.length>0){
data.push.apply(data,result);
}
});
}
}
return data;
}

var dataresult = SC.ACHelper.getFilterDict(st_split);
console.log(dataresult);


console log shows empty array but on expanding the log array shows elements in the array.
seems like there is some scope error i am doing.

Reply all
Reply to author
Forward
0 new messages