【发布时间】:2014-02-18 11:36:28
【问题描述】:
// 控制器.js
$.tblRow_CurrentRow = [];
var currentList = [
{plan:' Plan1',date:'18 Feb 2014',tier:'one'},
{plan:'Plan2',date:'18 Dec 2013',tier:'two'},
{plan:'Plan3',date:'20 Feb 2014',tier:'three'},
var data = [];
for(var i=0;i < currentList.length ;i++){
if(i%2 == 0){
$.tblRow_CurrentRow[i].backgroundColor = "#FFFFFF";
}
else{
$.tblRow_CurrentRow[i].backgroundColor = "#ABC012";
}
// Set text data to the label
$.lbl_Plan.text = currentList[i].plan;
$.lbl_Date.text = currentList[i].date;
$.lbl_Tier.text = currentList[i].tier;
// Adding label to the TableRow!
$.tblRow_CurrentRow[i].add($.lbl_Plan);
$.tblRow_CurrentRow[i].add($.lbl_Date);
$.tblRow_CurrentRow[i].add($.lbl_Tier);
data.push($.tblRow_CurrentRow[i]);
}
$.tbl_TabeleView.data = data;
// 控制器.xml
<TableView id = "tbl_TabeleView" >
<TableViewRow id= "tblRow_CurrentRow">
<Label id = "lbl_Plan"></Label>
<Label id = "lbl_Date"></Label>
<Label id = "lbl_Tier"></Label>
</TableViewRow>
</TableView>
在钛合金中将 dataList 添加到 tableviewRow 的问题。
错误信息 message = "'undefined' 不是对象(评估 '$.tblRow_CurrentRow[i].add')";
【问题讨论】:
标签: javascript titanium titanium-alloy