Reputation: 21
I am using Sencha extjs 5. I am having trouble to load a tree menu in the west layout. I can't seem to display anything. Please assist.
Here is my Main.js code:
items: [
{
title: 'Navigation',
region:'west',
floatable: false,
margin: '5 0 0 0',
width: 200,
minWidth: 100,
maxWidth: 350,
html: '<script type="text/javascript" src="app/view/app.js"></script>'
}
Here is my app.js code:
Ext.create('Ext.tree.Panel', {
renderTo: 'west',
title: 'Simple Tree',
width: 300,
height: 250,
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
}]
}]
}
});
Upvotes: 0
Views: 209
Reputation: 16140
If you use renderTo
then region
is not used. region
is only used when you add component into container with border layout.
Another thing Ext.getBody()
doesn't take any argument, so Ext.getBody('west')
returns just body element of page. If you have element (eg. div
) on page with west
id, then use renderTo: 'west'
.
Upvotes: 1