Hi All,
e.rowData return null value for Ti.UI.TableView control's click event specially when I have added section in table. This happen only in Android since on iPhone working perfectly fine. I have seen similar bug on bug report and indicate resolved on around March,2012 but seems miss for Android. Here is text code that cause issue. Let me know I am doing wrong.
function TestWin() { Ti.UI.backgroundColor = 'white'; var win = Ti.UI.createWindow(); var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' }); sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' })); sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' })); var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' }); sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' })); sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' })); var table = Ti.UI.createTableView({ data: [sectionFruit, sectionVeg] }); win.add(table); win.open(); var sectionFish = Ti.UI.createTableViewSection({ headerTitle: 'Fish' }); sectionFish.add(Ti.UI.createTableViewRow({ title: 'Cod' })); sectionFish.add(Ti.UI.createTableViewRow({ title: 'Haddock' })); table.setData([ sectionFish, sectionFruit, sectionVeg ]); table.addEventListener('click', function(e) { alert(e.rowData.title); }); return win; }; module.exports = TestWin;
3 Answers
Accepted Answer
Hi Pritesh Patel i found Your Problem And also the solution of your Problem what you need to do is just replace your alert at click event of table by
alert(e.row.title)and you will get your solution. and please mark the answer as permanent if your problem is solved
HI, In case of android, use e.row property instead of e.rowData.
Hi Pritesh, for a general advice whenever you find this kind of problem then simple use this way to find what you are getting.
table.addEventListener('click', function(e) { alert(JSON.stringify(e)); // then use the property accordingly });
Your Answer
Think you can help? Login to answer this question!