在 ExtJS 中向现有工具栏添加选项卡
我有一个现有的工具栏,想向其中添加选项卡,以便在使用卡片布局的两个面板之间翻转。我最好的选择是什么?有这样做的例子吗?
- 是否可以将选项卡添加到我现有的工具栏中?更改现有按钮上的 xtype 并没有为我提供我希望看到的选项卡。
- 创建一个选项卡面板,其中包含我的两张卡,将每个选项卡映射到其面板。使用此选项,我可以向选项卡面板添加其他按钮和菜单吗?
这是我现有的工具栏代码的示例,message_button 和 Attachments_button 是否可以简单地具有选项卡的 xtype,然后以某种方式模拟选项卡功能?
Ext.define('MyArchive.Toolbar', {
alias: 'myarchive.toolbar',
extend: 'Ext.toolbar.Toolbar',
dock: 'top',
width: '100%',
items: [
// Pretty straight forward buttons with a listener, nothing fancy
messages_button,
attachments_button,
'->',
{ xtype: 'button', id: 'forward-button', text: 'Forward' },
'-',
{ xtype: 'button', id: 'recover-button', text: 'Recover' },
'-',
{
text: 'Download',
menu: {
xtype: 'menu',
id: 'download-menu',
items: [
{xtype: 'menuitem', id: 'download-original', text: 'Original', iconCls: 'download-icon'},
{xtype: 'menuitem', id: 'download-pdf', text: 'PDF', iconCls: 'pdf-icon'}
]
}
}
]
I have an existing toolbar and would like to add tabs to it that would flip between two panels that use a card layout. What would be my best option and are there any examples of doing so?
- Is it possible to add the tabs to my existing toolbar? Changing the xtype on my existing buttons didn't provide me with the tabs I was hoping to see.
- Create a tab panel which would contain my two cards, mapping each tab to its panel. With this option, can I add additional buttons and menus to the tab panel?
Here's a sample of my existing toolbar code, can message_button and attachments_button simply have an xtype of tab and then somehow emulate the tab functionality?
Ext.define('MyArchive.Toolbar', {
alias: 'myarchive.toolbar',
extend: 'Ext.toolbar.Toolbar',
dock: 'top',
width: '100%',
items: [
// Pretty straight forward buttons with a listener, nothing fancy
messages_button,
attachments_button,
'->',
{ xtype: 'button', id: 'forward-button', text: 'Forward' },
'-',
{ xtype: 'button', id: 'recover-button', text: 'Recover' },
'-',
{
text: 'Download',
menu: {
xtype: 'menu',
id: 'download-menu',
items: [
{xtype: 'menuitem', id: 'download-original', text: 'Original', iconCls: 'download-icon'},
{xtype: 'menuitem', id: 'download-pdf', text: 'PDF', iconCls: 'pdf-icon'}
]
}
}
]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我试过了。但没有运气。
这是可能的。但结果看起来很丑(你可以用CSS装饰它)。
使用
tabpanel.tabBar.add()
添加按钮和菜单(这里是演示):I've tried it. But no luck.
It is possible. But result looks ugly (you can decorate it with CSS).
Use
tabpanel.tabBar.add()
to add buttons and menus (Here is demo):