2011-10-19 38 views
0

我很難理解爲什麼我不能回到我的應用程序中的前一個面板。少廢話,一些代碼不能回到前面板在Sencha使用「this.ownerCt.setActiveItem ...」

appsDetails = Ext.extend(Ext.Panel, { 
layout: 'fit', 
scroll: 'verticall', 

initComponent: function() { 

    this.dockedItems = [{ 
     xtype: 'toolbar', 
     items: [{ 
      ui: 'back', 
      scope: 'this', 
      handler: function() { 

       console.log(this.ownerCt) //This returns "undefined" 

       this.ownerCt.setActiveItem(this.prevCard, { 
        type: 'slide', 
        reverse: true, 
        scope: this, 
        after: function() { 
         this.destroy(); 
        } 
       }) 
      } 
     }] 
    }]; 

    this.items = [{ 
     styleHtmlContent: true, 
     tpl: description, 
     data: this.record.data 
    }]; 

    appsDetails.superclass.initComponent.call(this); 
} 
}); 

我在前面的面板下方使用此代碼獲取這個觀點上述

selection: function(list, index) { 

if (index[0] !== undefined) { 
    var details = new appsDetails({ 
     homeCard: this.appsPanel, 
     record: index[0], 
    }); 

    this.setActiveItem(details, {type: 'slide', direction: 'left'}) 
} 
} 

我沒有問題,得到所需面板,但我不能來回到前一個。

THX對您有所幫助

回答

0

你傳遞一個字符串對象與價值'this'。改變這一行:scope:'this' in scope:this

+0

謝謝,我沒有看到:)現在,我回到前面的面板,我注意到,我需要點擊兩次以前選擇的項目,以回到它的描述或一次在另一個項目上這樣做。任何想法? – slmd