passing arguments to addeventlistener in titanium

You must Login before you can answer or comment on any questions.

I require to pass arguments to callback handler of addEventListener. 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?

1 Answer

Finally got the solution at one of the posts here. Basically, i should remember that its javascript, which is loosely coupled language.

Your Answer

Think you can help? Login to answer this question!