如何设置 TabPanel 的选项卡宽度和选项卡高度?
我试过了:
var myTabPanel = Ext.create('Ext.TabPanel', {
fullscreen: true,
tabBarPosition: 'top',
resizeTabs: true,
tabWidth: 300,
//minTabWidth: 300
....
但它不起作用
如何设置 TabPanel 的选项卡宽度和选项卡高度?
我试过了:
var myTabPanel = Ext.create('Ext.TabPanel', {
fullscreen: true,
tabBarPosition: 'top',
resizeTabs: true,
tabWidth: 300,
//minTabWidth: 300
....
但它不起作用
这一切都发生在 senchacss
文件中。你需要在那里修改它。
好消息,
我找到了以编程方式执行此操作的方法。
//assuming you are using the MVC structure as suggested
/*In the controller class of your view with the tab panel you must have reference to the tab panel in refs config.
The reference name for this case will be: myTabpanel
*/
//somewhere in the controller class
var tabPanelItems = this.getMyTabpanel().getItems; //get all the items inside the tab panel (if i'm not mistaken this will also return some "extra" item which is not panel
for (var i = 0; i < panels.length; i++) {
//due to that extra item i mentioned, need to make sure current item is a tab by confirming "tab" property existence
if (panels.items[i].tab) {
panels.items[i].setWidth('100px');
panels.items[i].setHeight('25px');
}
}
就是这样。关键是它是一个选项卡面板(带面板的选项卡),因此要仅配置选项卡部分,我们首先需要获取选项卡部分,否则我们将默认配置面板部分。