Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Table row null error

$
0
0

Can someone tell me why e.rowData is returning null in the code below? Only happening on the Android platform. Works fine in iOS 8.

We are getting a Runtime Error, "Uncaught TypeError: Cannot read property 'title' or null", alert( rowdata.title )

Running Studio Titanium Studio, build: 3.4.1, WIndows 7/64, Android SDK 2.33, Android latest installed version says 4.1.2

I've cleaned the build but still have this issue. Not sure what I am missing. I'm sure it's an error between the chair and the keyboard but any help would be appreciated. :/

var myWindow = Titanium.UI.currentWindow;
 
var endoDB=Titanium.Database.install('mydata.db','mydataDB' + Ti.App.dbVer);
 
var hotTableViewSection = Titanium.UI.createTableViewSection({headerTitle:'Select an item'}); 
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'BF'})); 
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'CF'})); 
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'CHF'}));
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'CYF'}));
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'ENF'}));
hotTableViewSection.add(Titanium.UI.createTableViewRow({title:'GF'}));
 
 
// Create a TableView 
var myTableView = Titanium.UI.createTableView({
});
 
myTableView.setData([hotTableViewSection]);
 
myTableView.addEventListener('click', function(e) {
 
    var rowdata = e.rowData;
 
    //Show the item text of the selected row
    alert( rowdata.title );
 
 
    var newWindow = Titanium.UI.createWindow({
        backgroundColor:'#5A3F28',
        backgroundImage:'images/bkg.jpg',
        title:'Olympus',
        barColor:'#725F48',
        url:'brandinfo.js'
    });
    Titanium.UI.currentTab.open(newWindow);
 
    if (Titanium.Platform.name != 'android') {
       myTableView.selectRow(e.index); 
    }
 
});
 
// Add table to the window and open it 
myWindow.add(myTableView); 
myWindow.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>