我目前正在使用 Sencha Touch 1 开发一个应用程序。我的 TabPanel 中有 2 个项目。搜索和报警。
单击“搜索”选项卡会显示 4 的列表。当用户单击列表中的第 4 个项目时,他应该自动被定向到警报选项卡,而无需手动单击该选项卡。
有没有我可以使用的功能。
我是 Sencha touch 的初学者。欢迎提出建议。
这是我的 app.js
ToolbarDemo=new Ext.Application({
name:'ToolbarDemo',
launch:function(){
ToolbarDemo.views.Viewport=new Ext.TabPanel({
fullscreen:true,
defaults:
{
html:'',
styleHtmlContent:true,
} ,
tabBar:
{
dock:'bottom',
layout:{
pack:'center'
}
},
items:[
/*
{
xtype:'homecard'
},
*/
{
xtype:'searchcard'
},
/*
{
xtype:'actioncard'
},
*/ {
xtype:'settingscard'
},
{
xtype:'morecard'
},
] ,
});
}
});
并且 searchcard 有以下代码(searchcard.js)
Ext.regModel('Contact',{
fields:['firstName','lastName']
});
//create a store
var liststore = new Ext.data.Store({
model:'Contact',
getGroupString:function(record){
return record.get('firstName')[0];
},
data:[
{firstName:'Network Summary'},
{firstName: 'Alarms and Alerts'},
]
});
detailpanel=new Ext.Panel({
layout:'fit',
id:'detailpanel',
html:'HELLO ',
});
listpanel =new Ext.List({
id:'indexlist',
store:liststore, //take data from store created above
itemTpl:'{firstName}',
indexBar:true , //property of list
onItemDisclosure:function(record)
{
mainpanel.setActiveItem('detailpanel');
}
});
mainpanel=new Ext.Panel({
id:'mainpanel',
layout:'card',
items:[
listpanel,detailpanel
],
});
ToolbarDemo.views.Searchcard= Ext.extend(Ext.Panel,{
title:'Search',
iconCls:'search',
badgeText:'1',
layout:'fit',
//items:[listpanel],
initComponent: function() {
Ext.apply(this, {
items:[mainpanel],
});
ToolbarDemo.views.Searchcard.superclass.initComponent.apply(this, arguments);
}
}) ;
Ext.reg('searchcard',ToolbarDemo.views.Searchcard);
我的警报选项卡有以下代码(morecard.js)
Ext.regModel('Contact',{
fields:['firstName','lastName']
});
var liststore = new Ext.data.Store({
model:'Contact',
getGroupString:function(record){
return record.get('firstName')[0];
},
data:[
{firstName:'Critical Alarms'},
{firstName: 'Major alarms'},
{firstName: 'Minor alarms'},
{firstName: 'Alerts'},
]
});
detailpanel=new Ext.Panel({
id:'detailpanel',
tpl:'HELLO ',
});
listpanel_my =new Ext.List({
id:'indexlist',
store:liststore, //take data from store created above
itemTpl:'{firstName}',
indexBar:true , //property of list
onItemDisclosure:function(record)
{
// ToolbarDemo.views.Viewport.setActiveItem('detailpanel');
}
});
ToolbarDemo.views.Morecard = Ext.extend(Ext.Panel, {
title: "Alarms",
iconCls: "more",
cardSwitchAnimation: 'slide',
initComponent: function() {
Ext.apply(this, {
items:[listpanel_my] ,
});
ToolbarDemo.views.Morecard.superclass.initComponent.apply(this, arguments);
}
});
Ext.reg('morecard', ToolbarDemo.views.Morecard);
我特别希望当我在搜索选项卡(searchard.js)中单击名为警报和警报的列表项之后,我自动希望我的警报选项卡处于活动状态并显示其项目(主要警报、次要警报等)