Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Titanium 钛合金表视图节标题_Titanium_Tableview - Fatal编程技术网

Titanium 钛合金表视图节标题

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

我已经在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);    
    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();