Titanium 钛合金表视图节标题
我已经在Tianium项目中为tableview创建了自定义标题视图Titanium 钛合金表视图节标题,titanium,tableview,Titanium,Tableview,我已经在Tianium项目中为tableview创建了自定义标题视图 var headerView = Ti.UI.createView({ height: 40,backgroundColor:'#00928F' }); var headerLabel = Ti.UI.createLabel({ text: array_interview_dates[i],color:'white' }); headerView.add(headerLabel); heade
var headerView = Ti.UI.createView({ height: 40,backgroundColor:'#00928F' });
var headerLabel = Ti.UI.createLabel({ text: array_interview_dates[i],color:'white' });
headerView.add(headerLabel);
headerViewArray.push(headerView);
现在,当我想在选择行时获取节标题时
table.addEventListener('click', function action_table(e){
var header_title=e.section.headerTitle;
}
我得到的是空值,我想得到section\u HeaderTitle在您的代码中没有section的定义 您应该在剖面定义中定义特性headerTitle以使其可用,如本例所示(改编自):
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();
var sectionFruit = Ti.UI.createTableViewSection({ headerTitle: 'Fruit' });
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Apples' }));
sectionFruit.add(Ti.UI.createTableViewRow({ title: 'Bananas' }));
var sectionVeg = Ti.UI.createTableViewSection({ headerTitle: 'Vegetables' });
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Carrots' }));
sectionVeg.add(Ti.UI.createTableViewRow({ title: 'Potatoes' }));
var table = Ti.UI.createTableView({
data: [sectionFruit, sectionVeg]
});
table.addEventListener('click', function(e){
Ti.API.info(e.rowData.title);
Ti.API.info(e.section.headerTitle);
});
win.add(table);
win.open();