I require to pass arguments to callback handler of addEventListener. I tried this, but it doesn't work in for loop. Here is my code:
var view = Ti.UI.createView({
//configuration here.
});
for(var i=0,ilen=response.length; i<ilen; i++){
var thisObj = response[i];
var btnCareer = Ti.UI.createButton({
//configuration here
});
var careerID = thisObj.CareerID;
btnCareer.addEventListener('click', function(){
bh.logic.career.CareerClick(careerID);
});
view.add(btnCareer);
}
What i get is the latest value.
Is there any way?