我目前正在使用Sencha Touch 1的應用程序。 我在我的TabPanel中有2個項目。搜索和警報。顯示一個選項卡沒有顯式點擊標籤圖標
單擊時的搜索選項卡給出了4的列表。 當用戶點擊列表中的第4項時,他應該自動定向到報警選項卡,而無需手動點擊選項卡。
有沒有我可以用來做的任何功能。
我是初學者在Sencha touch.Suggestions是受歡迎的。
這是我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)後,我自動想要我的報警標籤處於活動狀態並顯示其項目(主要報警,次要報警等)
我已經編輯了我的問題,請參閱它。 – 2013-02-09 09:47:45
對不起,縮進和其他不必要的代碼。我不得不創建一個虛擬代碼,因爲我無法複製粘貼我的原始代碼和其他文件在這裏。 – 2013-02-09 09:56:48