Am I missing something here? I thought this would work.
function showChildren(obj) { var data = []; for (var c = 0; c < obj.length; c++) { var title = obj[c].firstname + " " + obj[c].lastname; var id = obj[c].id; alert(title); var picture = obj[c].profilePic; if(picture === ""){ picture = "http://localhost/default/no.jpg"; } var post_view = Ti.UI.createView({ height : '120dp', id :id, left : 5, top : 5, bottom : 5, right : 5, }); var av = Ti.UI.createImageView({ image : picture, left : 2, top : 2, height : 100, width : 100 }); post_view.add(av); var user_label = Ti.UI.createLabel({ text : title, left : 105, top : 0, height : 'auto', textAlign : 'left', color : '#444444', font : { fontFamily : 'Trebuchet MS', fontSize : 30, fontWeight : 'bold' } }); post_view.add(user_label); data[c] = post_view; } var view = Ti.UI.createView({ layout : 'vertical', backgroundColor:'#D9D9D9' }) view.add(data); view.addEventListener('click',function(e){ alert(e.post_view.id); }) self.add(view); }It says it cannot find "e.post_view.id". I'm wanting it so when i click on the view it gives me the id from that view.
Any ideas?
Thanks.
1 Answer
Accepted Answer
Hi Michael, can you put it here whats the value of e you are getting on click event?
also i noticed semicolon is missing at event click and createView function call, so correct it as well.
Your Answer
Think you can help? Login to answer this question!