2012-02-23 98 views
0

我目前正在爲我的新項目使用ExtJS 4。我正在使用MVC架構併爲其他組件使用小部件。如何擴展Ext.tab.Panel

問題是我無法爲Ext.tab.Panel製作實例。這裏是我的代碼

app.js

Ext.Loader.setConfig({ enabled: true }); 
Ext.application({ 
     name: 'FBSPAM', 
     autoCreateViewport: false, 
     appFolder: 'app', 
     controllers: ['Users'], 
     launch: function(){  
       Ext.create('Ext.container.Viewport', {   
        layout: 'border',  
        title: 'App',   
        items: [ 
          {     
           region: 'west',     
           title: 'Menu',     
           width: 250,     
           xtype: 'accordionmenu'    
          }, 
          {     
           region: 'center',     
           xtype: 'tab'    
           //items: tabpanel    
          }   
        ]  
       }); 
     } 
}); 

視圖/ Tab.js

Ext.define('FBSPAM.view.Tab',{ 
     extend: 'Ext.tab.Panel', 
     alias: 'widget.tab', 
     height: '100%', 
     layout: 'fit', 
     border: false, 
     initComponent: function(){  
      this.items = [   
        { 
         title: "Hello", 
         html: "Hello World"   
        }     
      ];    
      this.callParent(arguments); 
     } 
}); 

錯誤消息:

Uncaught RangeError: Maximum call stack size exceeded 

回答

0

那是因爲你所使用的別名。將alias: 'widget.tab'更改爲其他內容(例如,widget.tab2),它將起作用。

+0

大聲笑,我不知道是否使用「標籤」。謝啦 – 2012-02-23 08:48:19