2013-10-10 11 views
5

की 'आइटम' पढ़ा नहीं जा सकता आप नमूना बदल सकते हैं: app/simple/app/Viewport.js यह करने के लिए:ExtJS 4.1: तो अजीब त्रुटि: Uncaught TypeError: गुण अपरिभाषित

Uncaught TypeError: Cannot read property 'items' of undefined ext-all.js:18 Ext.cmd.derive.getDockedItems

:

आप क्रोम कंसोल में इस त्रुटि मिलेगी

लेकिन यदि आप टिप्पणी करते हैं:

initComponent : function() { 
          this.callParent(); 
         }, 

सब कुछ ठीक है।

Ext.define('AM.view.Viewport', { 
     extend : 'Ext.container.Viewport', 

     layout: 'border', 
     items : [{ 
        border : false, 
        region : 'north', 
        xtype : 'progressbar', 
        text : 'Ready', 
        height : 20 
       }, { 
        region : 'west', 
        xtype : 'userlist', 
        width:300 
       }, { 
        region : 'center', 
        xtype : 'treepanel', 
        initComponent : function() { 
         this.callParent(); 
        }, 
        columns : [{ 
           xtype : 'treecolumn', 
           sortable : false, 
           width : 200, 
           text : 'lala', 
           dataIndex : 'text' 
          }, { 
           flex : 1, 
           sortable : false, 
           text : 'haha', 
           dataIndex : 'pars' 
          }] 
       }] 
    }); 

उत्तर

1

1- कोशिश इस तरह माता-पिता को तर्क के साथ कॉल करने के लिए:

. 
. 
. 
,initComponent : function() { 
this.callParent(arguments); 
}, 
. 
. 
. 

या सुपर क्लास फोन:

. 
. 

,initComponent : function() { 
    this.callSuper(arguments); 
}, 
. 
. 
. 
1

initComponent केवल नव परिभाषित घटक के लिए काम करता है। 'AM.view.Viewport' के लिए आपके मामले में। आइटम में घटक की कॉन्फ़िगरेशन के रूप में डाले गए घटक के लिए आप initComponent को ओवरराइड नहीं कर सकते हैं। यदि आप उस वृक्षारोपण के लिए initComponent को परिभाषित करना चाहते हैं, तो आपको इसे भी विस्तारित करना होगा और फिर इस एक्सटेंशन को अपने व्यूपोर्ट के आइटम में रखना होगा।

संबंधित मुद्दे