Sencha touch 卡布局setActiveItem未触发

Sencha touch 卡布局setActiveItem未触发,sencha-touch,extjs,Sencha Touch,Extjs,setActiveItem函数正在启动,但没有发生任何事情,并且我没有收到任何错误消息。有人能告诉我为什么这不起作用吗 Ext.regModel('team', { fields: [ {name: 'name', type: 'string'}, ] }); Dashboard = new Ext.Application({ name:'Dashboard', launch: function(){ //Info list var detailPanel =

setActiveItem函数正在启动,但没有发生任何事情,并且我没有收到任何错误消息。有人能告诉我为什么这不起作用吗

Ext.regModel('team', {
fields: [
    {name: 'name', type: 'string'},
    ]
});

Dashboard = new Ext.Application({
    name:'Dashboard',
    launch: function(){
//Info list 
var detailPanel = new Ext.Panel({
        id:'detailPanel',
        dock:"top",
         items: [{
            fullscreen:true,
            xtype: 'list',
            store: new Ext.data.Store({
                model: 'team',
                getGroupString : function(record) {
                    return record.get('name')[0];
                },
                proxy: new Ext.data.AjaxProxy({
                    url: 'a.php/pool/listPools'
                    ,method:'post',
                    reader: {
                type: 'json',
                root: 'data',
                totalCount: 'count'
                     }
                })
                ,autoLoad:true 
            }),
            sorters: [{
            property: 'name',
            direction: 'asc'
             }],
            itemTpl:'<font size="4" face="Helvetica, Arial" color="black">{name}</font>',
            grouped: true,
            onItemDisclosure : true,
                  listeners : {
              itemtap : function(record,index,item,e){
if (e.getTarget('.x-list-disclosure')) {
                     var recPool = this.store.data.items[index];
                   //Ext.Msg.alert([index]);
                    var redirect = 'showpool.php'; 
                    window.location = redirect;
                 } 
                // else { Ext.Msg.alert("Item clicked!");}
               }
             }
        }]
    })
     var outer = new Ext.Panel({
                    fullscreen:true,
                    layout:'card',
                    items:[


                          detailPanel
                        ]
                    });

//------------------------------------Toolbar top
       var TopPanel = new Ext.Panel({
            id:'testview',
            fullscreen:true,
            style: "background-color: #GGG;",
             dockedItems: [
                                    {
                                        dock : 'top',
                                        xtype: 'toolbar',
                                        title: 'Pools',
                                        ui:'light',
                                        items: [
                                            {
                                                text: 'Logout',
                                                ui:'back',
                                                 handler: function(){
                                                              outer.setActiveItem('detailPanel', { type: 'slide', cover: false, direction: 'left'});
                                                  }


                                            }, {xtype: 'spacer'},
                                            {
                                                text: 'Refresh',
                                                ui:'action',
                                                handler: function(){
                                                            detailPanel.doLayout();
                                                  }
                                            }
                                        ]
                                    },
                  outer]
            });
    }
});
Ext.regModel('team'{
字段:[
{name:'name',type:'string'},
]
});
仪表板=新的外部应用程序({
名称:'Dashboard',
启动:函数(){
//信息列表
var detailPanel=新的外部面板({
id:'detailPanel',
码头:“顶部”,
项目:[{
全屏:对,
xtype:'列表',
存储:新的Ext.data.store({
模型:“团队”,
getGroupString:函数(记录){
返回记录。get('name')[0];
},
代理:新Ext.data.AjaxProxy({
url:'a.php/pool/listPools'
,方法:'post',
读者:{
键入:“json”,
root:'数据',
totalCount:'计数'
}
})
,自动加载:真
}),
分拣机:[{
属性:“名称”,
方向:“asc”
}],
itemTpl:“{name}”,
对,,
对,是的,
听众:{
itemtap:函数(记录、索引、项、e){
if(例如getTarget('.x-list-disposition')){
var recPool=this.store.data.items[index];
//外部消息警报([索引]);
var redirect='showpool.php';
window.location=重定向;
} 
//else{Ext.Msg.alert(“单击项目!”);}
}
}
}]
})
外部变量=新的外部面板({
全屏:对,
布局:'卡片',
项目:[
详细面板
]
});
//------------------------------------工具栏顶部
var TopPanel=新的外部面板({
id:'testview',
全屏:对,
样式:“背景色:#GGG;”,
摘要:[
{
码头:“顶部”,
xtype:'工具栏',
标题:"泳池",,
ui:“轻”,
项目:[
{
文本:“注销”,
用户界面:'返回',
处理程序:函数(){
setActiveItem('detailPanel',{type:'slide',cover:false,direction:'left'});
}
},{xtype:'spacer'},
{
文本:“刷新”,
ui:“操作”,
处理程序:函数(){
detailPanel.doLayout();
}
}
]
},
外]
});
}
});

您在此处将其用作字符串:

outer.setActiveItem('detailPanel', 
    {type: 'slide', cover: false, direction: 'left'});
改为使用变量:

outer.setActiveItem(detailPanel, 
    {type: 'slide', cover: false, direction: 'left'});

这应该是可行的。

实际上,如果面板中添加了两个或多个项目,卡布局用于在视图之间切换。在您的情况下,外部面板由单个视图组成。因此,它将始终显示该面板。尝试将另一个面板添加到外部面板中,并调用setActiveItem()