2011-07-28 8 views
0

다음 응용 프로그램에서 xtype으로 다음 코드를 사용하고 있습니다. 내 목록 항목이 내가 원하는 방식으로 나타나지만 항목을 클릭 할 때마다 데이터가있는 새 페이지를로드해야하는 항목을 클릭 할 때마다이 오류가 발생합니다. Uncaught TypeError : Object function() {h.apply (this , arguments)}에는 'setActiveItem'메서드가 없습니다. 내가 고칠 수있는 방법에 대한 생각은? 언급 된 항목 행은 코드에서 주석 처리됩니다. 여기 Sencha : 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); 

감사합니다, 나는이기 때문에 나는이 문제가 발생하고 유일한 이유가 있음을 발견했습니다 패널을 확장하려고합니다. 내가 들을 Ext.extend (Ext.Panel의 새로운 Ext.Panel intead를 사용하는 경우 다른 측면에서, {... 모든 작동 잘 내가이 경우에는하기 위해 xtype을 사용할 수 없습니다 제외. 어떤 아이디어?

답변

0

I .,

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); 

이 안 함 방법 제공 : 그것을 알아 냈다! MY 솔루션은 가능한 한 적은 수의 인수로 새로운 확장 클래스를주는 구성 따라서 나는이 같은 두 개체로 홈 확장 클래스를 구분 나는 대답 할 수 없을 것이다. 나는 직감을 따라 갔다.)

관련 문제