将 Ext.Button 类添加到 Box 组件中
我正在使用 extjs 2.2.1,在将按钮添加到框组件类中时遇到一些麻烦。 根据我的理解,因为盒子组件扩展了组件类,所以它没有允许添加项目的配置选项。 所以下面的代码不起作用...
new Ext.Viewport({
layout : 'border',
items : [new Ext.BoxComponent({
region : 'north',
el : 'north',
height : 50,
items : new Ext.Button({
iconCls : 'logout',
text : 'logout',
tooltip : 'logout',
handler : function() { }
}, mainTabPanel])
});
是否有一种解决方法可以将按钮添加到由 boxcomponent 类组成的北部区域? 非常感谢任何正确方向的帮助。 谢谢。
I'm working with extjs 2.2.1, having a bit of a trouble adding a button into a box component class. From my understanding, because box component extends the component class, it has no config options that allow an item to be added. So the code below does not work...
new Ext.Viewport({
layout : 'border',
items : [new Ext.BoxComponent({
region : 'north',
el : 'north',
height : 50,
items : new Ext.Button({
iconCls : 'logout',
text : 'logout',
tooltip : 'logout',
handler : function() { }
}, mainTabPanel])
});
Is there a workaround where I can can add a button into this northern region that is made up of a boxcomponent class? Any help in the right direction is greatly appreciated. Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
BoxComponent 无法包含子项,如果您查看文档,您会发现没有配置选项可以执行此操作。 您将需要使用容器(或其某些子类)来获得此效果。
BoxComponent doesn't have the ability to contain child items, if you look at the docs you'll see there isn't a configuration option to do that. You will need to use a Container (or some subclass thereof) to get this effect.
无法在 BoxComponent 类中包含子项,因为它不是容器。 因此,我将 BoxComponent 更改为容器类,例如 Panel,它允许我添加按钮类。
There was no way around having child items in a BoxComponent class as it is not a container. so instead, I changed the BoxComponent to a container class, like Panel, that allowed me to add a button class.