I am new to titanium..I have created a tableview and I want to display the data from the database in the labels which are created and in the tableview form and could not achieve it..
Code:
var triplistview = Titanium.UI.createTableView({
backgroundColor : 'white',
width : Titanium.UI.FILL,
height : Ti.UI.SIZE,
layout : 'horizontal',
padding : '10dp',
separatorColor : theme_background
// margin:'10dp',
});
scrollView.add(triplistview);
var data = [];
var db = Titanium.Database.open('trip');
db.execute('CREATE TABLE IF NOT EXISTS newtrip (id INTEGER PRIMARY KEY AUTOINCREMENT, triplabel TEXT,tripname TEXT,destination TEXT,fromdate TEXT,todate TEXT)');
while (resultrows.isValidRow()) {
var row = Ti.UI.createTableViewRow({
height : Ti.UI.SIZE,
rightImage : '/images/right1.png',
layout : 'absolute',
//title : '' + 'Destination' + '' + '' + resultrows.fieldByName('destination') + '' + 'From Date:' + '' + '' + resultrows.fieldByName('fromdate') + '' + 'To Date:' + '' + resultrows.fieldByName('todate')
});
row.add(tripnamelabel);
row.add(buttonedit);
row.add(buttondelete);
row.add(fromdate);
row.add(dash);
row.add(todate);
triplistview.add(row);
row.className = 'control';
data.push(row);
resultrows.next();
}
triplistview.setData(data);
resultrows.close();
db.close();
These are the label I have created
var tripnamelabel = Ti.UI.createLabel({
text:resultrows.fieldByName('destination'),
color : theme_style,
font : {
fontSize : '15dp',
fontWeight : 'bold'
},
top : '10dp',
left : '10dp',
});
var buttonedit = Ti.UI.createButton({
backgroundImage : '/images/list_edit.png',
top : '20dp',
width : wb,
height : hb,
right : '20dp'
});
var buttondelete = Ti.UI.createButton({
backgroundImage : '/images/delete_ic.png',
top : '20dp',
width : wb,
height : hb,
right : '60dp'
});
var fromdate = Ti.UI.createLabel({
text:resultrows.fieldByName('fromdate')
color : 'Black',
font : {
fontSize : '13dp',
fontWeight : 'bold'
},
top : '40dp',
left : '10dp',
right : '10dp',
bottom : '20dp'
});
var dash = Ti.UI.createLabel({
text : '-',
color : 'Black',
font : {
fontSize : '15dp',
fontWeight : 'bold'
},
top : '40dp',
left : '80dp',
right : '10dp',
bottom : '20dp'
});
var todate = Ti.UI.createLabel({
text:resultrows.fieldByName('todate')
color : 'Black',
font : {
fontSize : '13dp',
fontWeight : 'bold'
},
top : '40dp',
left : '90dp',
right : '10dp',
bottom : '20dp'
});
Please help me in this as I am stuck in this for more than a day and I am getting this error
[ERROR] Application Installer abnormal process termination. Process exit value was 1