我在 View 中有一个选项卡面板,并且选项卡面板中有许多选项卡,我想在 Controller 中获取标题字符串
我的标签面板代码:
{
xtype: 'tabpanel',
itemId: 'tabfirst',
flex: 1,
//activeItem: 1,
tabBar: {
layout: {
pack: 'center'
}
},
items: [
{
title: 'tab1',//---------i want get it's value tab1
xtype: 'list',
itemTpl: '{title}',
data: [
{title : 'title1'},
{title : 'title2'},
{title : 'title3'}
]
},
{
title: 'tab2',
html: 'here second html2'
}
]
}
在 Controller 启动函数代码中
var moneytab = Ext.ComponentQuery.query('.makemoney #tabfirst')[0];
console.log(moneytab.getItems().......how can i get the value of title........);
上面的 getItems 在我的 chrome 控制台中返回数组列表
我的标题在数组 1 中在项目中。THX
最佳答案
您不是查询选项卡,而是查询选项卡面板本身。您显示的项目是选项卡面板的项目,而不是选项卡的项目。
{
xtype: 'tabpanel',
itemId: 'myTabPanel',
flex: 1,
tabBar: {
layout: {
pack: 'center'
}
},
items: [
{
title: 'tab1',
xtype: 'list',
itemId: 'myFirstTab',
itemTpl: '{title}',
data: [
{title : 'title1'},
{title : 'title2'},
{title : 'title3'}
]
},
{
title: 'tab2',
html: 'here second html2'
}
]
}
var tabPanel = Ext.ComponentQuery.query('#myTabPanel')[0],
moneyTab = tabPanel.child('#myFirstTab');
console.log(moneyTab.getTitle());
moneyTab.setTitle('w00t');
console.log(moneyTab.getTitle());
关于javascript - 在我的选项卡面板中获取标题属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32560554/