Extjs Sencha Touch Ext.TabPanel处理程序
我读了很多书,但我不明白这一点。 此应用程序使用Sencha Touch 2.0 我的“应用程序”有一个分段按钮Extjs Sencha Touch Ext.TabPanel处理程序,extjs,sencha-touch-2,Extjs,Sencha Touch 2,我读了很多书,但我不明白这一点。 此应用程序使用Sencha Touch 2.0 我的“应用程序”有一个分段按钮 xtype: 'segmentedbutton' 与此项目 { text: 'Blog', scope: this, handler: this.makeYqlRequest } { title: 'Blog', iconCls: 'home', html: 'Blog Screen' } 这就是它的作用 blog: { query: "select * from rs
xtype: 'segmentedbutton'
与此项目
{
text: 'Blog',
scope: this,
handler: this.makeYqlRequest
}
{
title: 'Blog',
iconCls: 'home',
html: 'Blog Screen'
}
这就是它的作用
blog: {
query: "select * from rss where url='http://feeds.feedburner.com/extblog' limit 5",
tpl: Ext.create('Ext.XTemplate', [
'<tpl if="item">',
'<tpl for="item">',
'<div class="blog-post">',
'<h3><a href="{link}" target="_blank">{title}</a></h3>',
'<p>{description}</p>',
'</div>',
'</tpl>',
'</tpl>'
])
}
如何从分段按钮获取处理程序以使用Ext.TabPanel?
我和一个听众玩了一会儿,但我无法让它发挥作用
有人能再给我解释一下吗
谢谢大家! 您需要获取对选项卡面板的引用,并调用
[setActiveItem](http://docs.sencha.com/touch/2-0/#!/api/Ext.Container-method-setActiveItem)
,传递要激活的视图或该视图的索引
简单示例(可查看):
Ext.setup({
onReady: function() {
var tabPanel = Ext.create('Ext.tab.Panel', {
fullscreen: true,
items: [
{
title: 'Home',
items: [
{
xtype: 'toolbar',
items: [
{
xtype: 'segmentedbutton',
items: [
{
text: 'home'
},
{
text: 'blog',
handler: function() {
// Using an index
tabPanel.setActiveItem(1);
}
},
{
text: 'about',
handler: function() {
// Using a reference
var about = tabPanel.down('#about');
tabPanel.setActiveItem(about);
}
}
]
}
]
},
{
html: 'tap one of the above buttons to change the active tab.'
}
]
},
{
title: 'Blog',
html: 'blog'
},
{
title: 'About',
itemId: 'about',
items: [
{
xtype: 'toolbar',
docked: 'top',
items: [
{
text: 'Go to home',
handler: function() {
// using the index
tabPanel.setActiveItem(0);
}
}
]
}
]
}
]
});
}
});