将不可选择的文本选项卡添加到 Ext.TabPanel?
我正在尝试创建一个 TabPanel,它在选项卡旁边有一个文本标题。也就是说,
我想要的不是 |Tab1|Tab2|Tab3|Tab4|
,而是 Text Here |Tab1|Tab2|Tab3|Tab4|
文本不应该被选择为一个选项卡,那么我该怎么做呢?
目前,我的 TabPanel 是这样的:
new Ext.TabPanel({
id: 'lift-template',
defaults: {
items:[
{
xtype: 'list',
store: myStore,
itemCls: 'my-row',
itemTpl: '<p><span class="blah">{variable}</span></p>'
}
]
},
items: [
{title:'Week'},
{title: '1'},
{title: '2'},
{title: '3'},
{title: '4'}
]
});
如何添加不是真正选项卡的项目,或者至少禁用激活?
I'm trying to create a TabPanel that has a text header just beside the tabs. That is, instead of
|Tab1|Tab2|Tab3|Tab4|
, I want Text Here |Tab1|Tab2|Tab3|Tab4|
The text shouldn't be selectable as a tab, so how do I do this?
Currently, my TabPanel is this:
new Ext.TabPanel({
id: 'lift-template',
defaults: {
items:[
{
xtype: 'list',
store: myStore,
itemCls: 'my-row',
itemTpl: '<p><span class="blah">{variable}</span></p>'
}
]
},
items: [
{title:'Week'},
{title: '1'},
{title: '2'},
{title: '3'},
{title: '4'}
]
});
How do I add an item that isn't a true tab, or at least disable activation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
与 SeanA 提供的答案有点相似,这是 Sencha Touch (1.1) 的修改版。
查看示例
Slighly similar to the answer provided by SeanA, this is the modified one for Sencha Touch (1.1).
Check out the example
我不会尝试使用选项卡的功能来侵入标签。您想要的只是一个标签,因此您可以查看
TabPanel
的源代码并找到一个方便的位置来添加它。我刚刚查看了
Ext.TabPanel
(Ext 3.3.1)的源代码,onRender
是创建选项卡条的方法,所以我要做的是创建Ext.TabPanel
的自定义扩展,将其命名为MyApp.WeeksTabPanel
,并重写onRender
方法以在调用超类方法后添加标签。看起来您可能只需添加一个自定义范围作为this.stripWrap
的第一个子项。像这样的事情:
I wouldn't try to hack in a label using the functionality of a tab. All you want is a label, so you can probably look through the source code of
TabPanel
and find a conventient place to add this.I just looked through the source of
Ext.TabPanel
(Ext 3.3.1), andonRender
is the method where the tab strip is created, so what I would do is create a custom extension ofExt.TabPanel
, call itMyApp.WeeksTabPanel
, and override theonRender
method to add your label after calling the superclass method. Looks like you might just add a custom span as the first child ofthis.stripWrap
.Something like this: