Quantcast
Viewing all articles
Browse latest Browse all 8068

For Loop if/else

I've got the below loop but it only brings back the first value, can't see where i've gone wrong

for (var i = 0; i < row.length; i++) {
             var img = row[i].picture.data.url
                if (row[i].installed) {
                    var row = Ti.UI.createTableViewRow({
                        title : row[i].first_name + " " + row[i].last_name,
                        id : row[i].id,
                        gender : row[i].gender,
                        leftImage: img
                    });
                    pData.push(row)
                    playTableView.appendRow(row)
                } else {
                    var img = row[i].picture.data.url
                    var row = Ti.UI.createTableViewRow({
                        title : row[i].first_name + " " + row[i].last_name,
                        id : row[i].id,
                        leftImage : img
                    });
 
                    iData.push(row)
                    inviteTableView.appendRow(row)
                }
 
            }
If i add an Ti.API.info(row.length) it shows me that there are 200+ rows, but if i add an Ti.API.info('no' + i) its showing that it stops at the first one because all i can see in the console is no0

Viewing all articles
Browse latest Browse all 8068

Trending Articles