PDA

View Full Version : Problem with loading view



p0rsche
20 Nov 2011, 12:22 PM
Hi All!
I have a problem loading one view into Viewport. Other views are loaded nice.
Here is my viewport.js:

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

requires: [
'Dashboard.view.Header',
'Dashboard.view.Footer',
'Dashboard.view.Leftsidebar',
'Dashboard.view.MainContent'
],

id: 'dashboard-viewport',
layout: 'border', // don't forget to enable 'center' region :D

initComponent: function(){
Ext.apply(this, {
items: [{
xtype: 'header'
},{
xtype: 'footer'
},{
xtype: 'leftsidebar'
},{
xtype: 'maincontent'
}
]
});

this.callParent(arguments);
}



});
and my Leftsidebar.js:

Ext.define('Dashboard.view.Leftsidebar', { extend: 'Ext.tree.Panel',

alias: 'widget.leftsidebar',
region: 'west',
stateId: 'navigation-panel',
id: 'west-panel', // see Ext.getCmp() below
title: 'West',
split: true,
width: 200,
minWidth: 175,
maxWidth: 400,
collapsible: true,
animCollapse: true,
margins: '0 0 0 5',
layout: 'accordion',
items: [{

title: 'Navigation',
//html: 'some here',
iconCls: 'nav' // see the HEAD section for style used
}, {
title: 'Settings',
//html: '<p>Some settings in here.</p>',
iconCls: 'settings'
}, {
title: 'Information',
//html: '<p>Some info in here.</p>',
iconCls: 'info'
}]
});

The problem is browser raises an error (comp.header is undefined).
When I moving code from leftsidebar directly to Viewport.js, all work good. Also, other view works good (the problem only with 'leftsidebar').
What's wrong?

Thank you for help!

p0rsche
20 Nov 2011, 12:36 PM
Oops...
I've extended from 'Ext.tree.Panel' instead of 'Ext.Panel'.
My fault (:|