如何在extjs 4中覆盖GroupTabPanel宽度
我想覆盖extjs4中的Ext.ux.GroupTabPanel width如何在extjs 4中覆盖GroupTabPanel宽度,extjs,Extjs,我想覆盖extjs4中的Ext.ux.GroupTabPanel width 有什么想法吗?选项卡栏的宽度确实被硬编码为150,所以您是对的,您必须重写或扩展该类 以下替代为GroupTabPanel添加了一个选项,以执行所需操作,而不更改默认行为: /** * This override adds the {@link #tabBarWidth} config option. */ // The name of the class is only used by the loader to
有什么想法吗?选项卡栏的宽度确实被硬编码为150,所以您是对的,您必须重写或扩展该类 以下替代为GroupTabPanel添加了一个选项,以执行所需操作,而不更改默认行为:
/**
* This override adds the {@link #tabBarWidth} config option.
*/
// The name of the class is only used by the loader to find the file
Ext.define('MyApp.Ext.ux.GroupTabPanelWidthOption', {
override: 'Ext.ux.GroupTabPanel'
/**
* Width of the tab bar.
*
* @cfg {Integer}
*/
,tabBarWidth: 150
,initComponent: function() {
this.callParent(arguments);
this.down('treepanel').setWidth(this.tabBarWidth);
}
});
当然,代码必须位于Ext的类装入器能够找到的文件中
可选地,如果你真的想要改变<强>默认宽度,你最好扩展类而不是重写它,以避免破坏遗留或外部代码的风险(如果你认为这不是你的问题,你可以在上面的代码中更改默认选项值)。 这就是你要做的:
/**
* A {@link Ext.ux.GroupTabPanel} with configurable tab bar width.
*
* @xtype largegrouptabpanel
*/
Ext.define('MyApp.tab.GroupTabPanel', {
extend: 'Ext.ux.GroupTabPanel'
,alias: ['widget.largegrouptabpanel']
/**
* Width of the tab bar.
*
* @cfg {Integer}
*/
,tabBarWidth: 300 // Notice the changed default
,initComponent: function() {
this.callParent(arguments);
this.down('treepanel').setWidth(this.tabBarWidth);
}
});
您到底想做什么?我想覆盖GroupTabPanel控件的宽度。bais类中提供了默认值150,我想通过重写将其更改为150。如果您希望重写组件,这将非常有用:。也: