gpt4 book ai didi

ExtJS 4 : Adding a button to a tab panel header

转载 作者:行者123 更新时间:2023-12-04 23:03:11 30 4
gpt4 key购买 nike

我正在使用 ExtJS 4 并尝试在选项卡面板标题上添加按钮。请看看这个jsfiddle:

http://jsfiddle.net/ramarajuv/Sadnj/7/ .您可以看到它仅使用两个选项卡就可以正常工作。现在,通过添加一个 tabBar 来修改相同的代码,如下所示:

Ext.create('Ext.panel.Panel',{
renderTo : Ext.getBody(),
id : 'testPanel',
height : 200,
width : 300,
items: [{
xtype : 'tabpanel',
activeTab : 1,
tabBar:[{
dockedItems:[{
xtype: 'button',
text : 'Test Button'
}]
}],
items: [{
title: 'tab1'
},{
title: 'tab2'
}]
}]
});

没有抛出 Javascript 错误,但我想在选项卡面板标题右侧看到的按钮没有出现。你能帮我在选项卡面板上调出一个按钮吗?

最佳答案

如果我理解您的问题,您似乎希望按钮位于 tabBar 本身而不是它自己的工具栏中?如果是这种情况,那么您可以使用此 fiddle 中提供的以下代码。

http://jsfiddle.net/Sadnj/15/

Ext.create('Ext.panel.Panel', {
renderTo: Ext.getBody(),
id: 'testPanel',
height: 200,
width: 200,
items: [{
xtype: 'tabpanel',
activeTab: 1,
tabBar: {
items: [{
xtype: 'tbfill'
}, {
xtype: 'button',
text: 'Test Button'
}]
},
items: [{
title: 'tab1',
}, {
title: 'tab2',
}]
}]
});

关于ExtJS 4 : Adding a button to a tab panel header,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18199793/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com