Javascript Sencha:uncaughttypeerror:Object函数(){h.apply(this,arguments)}没有方法';setActiveItem';

Javascript Sencha:uncaughttypeerror:Object函数(){h.apply(this,arguments)}没有方法';setActiveItem';,javascript,extjs,Javascript,Extjs,我在应用程序中使用以下代码作为xtype。我的列表项以我想要的方式显示,但当我单击一个项时,每次单击一个应加载新页面数据的项时都会出现此错误:Uncaught TypeError:Object function(){h.apply(this,arguments)}没有方法“setActiveItem”。你知道我该怎么修吗?引用的项目行在代码中注释 这是我的密码: var AppsBack = new Ext.Toolbar({ dock: 'top', items: [{ text: '

我在应用程序中使用以下代码作为xtype。我的列表项以我想要的方式显示,但当我单击一个项时,每次单击一个应加载新页面数据的项时都会出现此错误:Uncaught TypeError:Object function(){h.apply(this,arguments)}没有方法“setActiveItem”。你知道我该怎么修吗?引用的项目行在代码中注释

这是我的密码:

var AppsBack = new Ext.Toolbar({
dock: 'top',
items: [{
    text: 'back',
    ui: 'back',
    handler: function(){
        Home.setActiveItem('home'); //Here is the second problem
    }
}]
});

var AppsDetails = new Ext.Panel({
id: "appsdetails",
tpl: "{game}",
dockedItems: [AppsBack]
});

var AppsList = new Ext.List({
id: "appslist",
store: AppsStore,
layout: 'card',
emptyText: "No game found",
itemTpl: "{game}",
listeners: {
    itemtap: function(view, index, item, e) {
        var rec = view.getStore().getAt(index);
        AppsDetails.update(rec.data);
        AppsBack.setTitle(rec.data.game);
        Home.setActiveItem('appsdetails') //Here is the first problem
    }
}
});

var AppsListWrapper = new Ext.Panel({
id: "appslistwrapper",
layout: 'card',
items: [AppsList],
dockedItems: []
});

var Home = Ext.extend(Ext.Panel, {
id: "home",
iconCls: 'home', 
title: 'Home',
fullscreen: true,
layout: 'card',
cardSwitchAnimation: 'slide',

initComponent: function() {
    Ext.apply(this, {
        items: [AppsListWrapper, AppsDetails]
    });
    Home.superclass.initComponent.apply(this,arguments)
}
});
Ext.reg('appsList', Home);
谢谢你的帮助


经过几次操作后,我发现我遇到这个问题的唯一原因是因为我试图扩展面板。换句话说,如果我使用 新分机面板 intead of Ext.extend(Ext.Panel,{。。。 除了在这种情况下不能使用xtype外,一切都正常。有什么想法吗?

我想出来了!!! 我的解决方案是为新的扩展类提供尽可能少的参数。因此,我将主扩展类分为两个对象,如下所示:

var Home = new Ext.Panel({
id: "home",
layout: 'card',
cardSwitchAnimation: 'slide',
items: [AppsListWrapper, AppsDetails]
});

var HomeTab = Ext.extend(Ext.Panel, {
iconCls: 'home',
title: 'Home',
layout: 'card',
initComponent: function() {
    Ext.apply(this,{
        items: [Home]
    }); 
    HomeTab.superclass.initComponent.apply(this,arguments);
}
});
Ext.reg('home', HomeTab);
别问我为什么,我无法回答。我只是凭直觉;)