简体   繁体   中英

Extjs5 treepanel [Uncaught TypeError: Cannot read property 'create' of undefined]

I'm having a problem with treepanel in extjs5. when I create a tree panel like this:

Ext.syncRequire(['Ext.tree.Panel', 'Ext.form.Label', 'Ext.window.*', 'Ext.data.TreeStore' ]);

var myTreePanel = Ext.create('Ext.tree.Panel', { title: 'Simple Tree', width: 200, height: 150, store: store, rootVisible: false, });

then in the same file I have:

//Window view:

var treeViewWindow = Ext.create('Ext.window.Window', { items:[myTreePanel] });

Ext.application({ name: 'Training App', launch: function () { treeViewWindow.show(); } });

This doesn't work, and give me the error: Uncaught TypeError: Cannot read property 'create' of undefined in Component.js:5421

note that if I changed the treepanel with panel, it works. and if I put the whole code inside the lunch function (the window and treepanel variables) then it works too!

can anyone help me out here?

You just forgot to define store.

store: store

You code in fiddle

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM