So I have a window that holds several views and a tableview. The tableview works perfectly fine when I test it on iOS devices but it seems as though the rows are not visible or not being added for the android version.
The program is set up so that the user inputs some data into a popup window which creates an object and adds the object to a list(finalCourseListCT). To populate the table I'm using a for loop to cycle through the list of objects and create rows for the table's data list.
This setup works fine on iOS devices but there is a problem with the android version.
The window and tableview setup:
var courseListData = []; //window 2 var standardView1CT = Ti.UI.createView({ top:0, left:0, right:0, bottom:'85%', }); var label1CT = Ti.UI.createLabel({ top:'10%', left:0, right:0, bottom:'40%', textAlign: 'center', text: 'Semester GPA: ' + semesterGPA, color: 'white' }); var label2CT = Ti.UI.createLabel({ top:'60%', left:0, right:0, bottom:'10%', textAlign: 'center', text: 'Hours attempted: ' + semesterAttempted, color: 'white' }); var tableView1CT = Ti.UI.createTableView({ data:courseListData, top:'15%', left:0, right:0, bottom:'15%', backgroundColor: 'black', }); var standardView2CT = Ti.UI.createView({ top:'85%', left:0, right:0, bottom:0, backgroundColor:'#1e1e1e' }); var button1CT = Ti.UI.createButton({ top:'30%', left:'10%', right:'60%', bottom:'30%', color:'white', title: 'Add Course' }); var button2CT = Ti.UI.createButton({ top:'30%', left:'60%', right:'10%', bottom:'30%', color:'white', title: 'Export Courses' }); window2.add(standardView1CT); window2.add(standardView2CT); window2.add(tableView1CT); standardView1CT.add(label1CT); standardView1CT.add(label2CT); standardView2CT.add(button1CT); standardView2CT.add(button2CT); //Listener button1CT.addEventListener('click', function(e) { getInputCT(); }); button2CT.addEventListener('click', function(e) { importCTtoGT(); });Here is the function:
function setCTrows(){ courseListData.length = 0; for (var i = 0; i < finalCourseListCT.length; i++){ var name = finalCourseListCT[i].getName(); var iD = finalCourseListCT[i].getID(); var hours = finalCourseListCT[i].getHours(); var grade = finalCourseListCT[i].getGrade(); var color; if (finalCourseListCT[i].getGrade() >= 80){color = 'green';} else if (finalCourseList[i].getGrade() >= 65){color = 'yellow';} else {color = 'red';} var newRow=Ti.UI.createTableViewRow({ height: 20, }); newRow.add(Ti.UI.createLabel({ top: 0, left:'5%', right: '25%', height:'50%', color: 'white', text: '' + iD })); newRow.add(Ti.UI.createLabel({ top: '50%', left:'5%', right: '25%', height:'50%', color: 'white', text: '' + name })); newRow.add(Ti.UI.createLabel({ top: 0, left:'75%', right: 0, height:'50%', color: color, text: '' + grade + '%' })); newRow.add(Ti.UI.createLabel({ top: '50%', left:'75%', right: 0, height:'50%', color: 'white', text: '' + hours + 'hrs' })); courseListData[i] = newRow; } tableView1CT.setData(courseListData);};Can someone tell me why no rows are being displayed on the Android Version?