0
我正在用Titanium構建應用程序,我試圖從JSON對象生成汽車列表,但我似乎沒有得到任何結果。當我在循環內記錄變量時,我得到'未定義'。我在這裏做錯了什麼?從JSON對象中添加Titanium中的表格行
var cars = [
{title: 'VW Golf', pricePerHour: '6€'},
{title: 'Peugeot 206', pricePerHour: '5€'},
{title: 'Renault Clio', pricePerHour: '6,50€'}
];
var tableData = [];
var tableView = Titanium.UI.createTableView();
for (var i = 0; i < cars.length; i++) {
var tR = Ti.UI.createTableViewRow({
title: cars.title,
height: 100
});
tableData.push(tR);
}
tableView.setData(tableData);
main.add(tableView);
main.open();
任何幫助非常感謝,感謝您的時間。