我有两个选项卡布局。单击第一个选项卡按钮时,使用远程检索的数据填充行。这与第二个选项卡相同,但数据的布局不同。
我的问题是,当您在选项卡之间切换时,我需要在每个选项卡的第一行触发点击事件。
我正在为 android 构建这个应用程序。
任何帮助是极大的赞赏...
编辑:这是头顶的虚拟代码,希望它更有意义。
leftTableView = Ti.UI.createTableView({
data: populateTableView(0),
allowsSelection:true
});
function populateTableView(byType)
{
for(length of array loop){
var tableViewRow=Ti.UI.createTableViewRow({
my_obj:myObj[i]
});
tabledata=[]
tableViewRow.addEventListener('click',function(e){
e.row.setBackgroundImage('/images/selected-row-background.png');
}
if byType 0
loop array display row for each object element
tableData.push(tableViewRow);
return tabledata
if byType 1
loop array display row for each object element, display differently
tableData.push(tableViewRow);
return tabledata
}
}
tab 1 click event listener
populateTableView(0);
leftTableView.data[0].rows[0].fireEvent('click');//this fires but says e.row.setBackgroundImage is undefined
tab 2 click event listener
populateTableView(1)
leftTableView.data[0].rows[0].fireEvent('click');//this fires but says e.row.setBackgroundImage is undefined