Uncaught TypeError: не удается прочитать «элементы» свойства null
ошибка внутри initComponent
моя ошибка отображается, когда я использую свой xtype: 'treepanel', я думаю, что ошибка внутри initComponent
userName = localStorage.getItem("userName");
Ext.define('TutorialApp.view.main.Main', {
extend : 'Ext.container.Container',
requires :
[
'TutorialApp.view.main.MainController',
'TutorialApp.view.main.MainModel',
'TutorialApp.store.MainTree'
],
xtype : 'app-main',
controller: 'main',
plugins : 'viewport',
viewModel :
{
type : 'main'
},
layout : {
type : 'border'
},
items :
[
{
xtype : 'panel',
bind :
{
title: '{name} '+userName+''
},
region : 'west',
html : '<ul><li>This area is commonly used for navigation, for example, using a "tree" component.</li></ul>',
width : 250,
split : true,
collapsible : true,`enter code here`
bbar :
[
{
text : 'Button',
handler : 'onClickButton'
}
],
items : [
{
xtype : 'treepanel',
rootVisible : true,
store : 'MainTree',
initComponent: function()
{
// declare store
this.store = new TutorialApp.store.MainTree();
// declare all items
this.items = [
{
title: 'Tree'
}
];
this.callParent();
}
}
]
},
{
region : 'center',
xtype : 'tabpanel',
items :
[
{
title : 'Tab 1',
html : '<h2>Content appropriate for the current navigation.</h2>'
}
]
}
]
});
Этот магазин деревьев представляет собой простой магазин
Ext.define('TutorialApp.store.MainTree', {
extend: 'Ext.data.TreeStore',
root: {
text: 'Root',
expanded: true,
children: [
{
text: 'Child 1',
leaf: true
},
{
text: 'Child 2',
leaf: true
},
{
text: 'Child 3',
expanded: true,
children: [
{
text: 'Grandchild',
leaf: true
}
]
}
]
}
});
любая помощь ?