2016-07-23 1 views
0

私はExtJSを使用して簡単なUIを構築します。私はMainMenuというビュークラスを2つ作成しました。その後、私はこれらのクラスを以下のように含めました。しかし、私はエラーに出会った。 TypeError: item.onAdded is not a functionがコンソールに印刷されました。ここに私のコードExtJS TypeError:item.onAddedは関数ではありません

Main.js

Ext.define('Ext1.view.Main', { 
    extend: 'Ext.container.Container', 
    requires:[ 
     'Ext.tab.Panel', 
     'Ext.layout.container.Border' 
    ], 
    items : [ 
     { 
      xtype : 'menume' 
     } 
    ] 
}); 

Menu.js

Ext.define('Ext1.view.Menu',{ 
    alias : 'widget.menume', 
     title: 'User Form', 
    height: 150, 
    width: 300, 
    bodyPadding: 10, 
    defaultType: 'textfield', 
    items: [ 
     { 
      fieldLabel: 'First Name', 
      name: 'firstName' 
     }, 
     { 
      fieldLabel: 'Last Name', 
      name: 'lastName' 
     }, 
     { 
      xtype: 'datefield', 
      fieldLabel: 'Date of Birth', 
      name: 'birthDate' 
     } 
    ] 
}); 

Application.js

Ext.define('Ext1.Application', { 
    name: 'Ext1', 

    extend: 'Ext.app.Application', 

    views: [ 
     'Ext1.view.Menu', 'Ext1.view.Main' 
    ], 

    controllers: [ 
     // TODO: add controllers here 
    ], 

    stores: [ 
     // TODO: add stores here 
    ] 
}); 

私が持っているのはなぜそのエラーがありますか?

答えて

2

Ext1.view.Menuは何も拡張していません。それは少なくともコンテナを持っている必要があります。

0
Ext.define('Ext1.view.Menu',{ 
    extend: 'Ext.menu.Menu'// add this 
    alias : 'widget.menume', 
     title: 'User Form', 
    height: 150, 
    width: 300, 
    bodyPadding: 10, 
    defaultType: 'textfield', 
    items: [ 
     { 
      fieldLabel: 'First Name', 
      name: 'firstName' 
     }, 
     { 
      fieldLabel: 'Last Name', 
      name: 'lastName' 
     }, 
     { 
      xtype: 'datefield', 
      fieldLabel: 'Date of Birth', 
      name: 'birthDate' 
     } 
    ] 
}); 
関連する問題