PDA

View Full Version : Panel.getComponent empty



anortje
4 Apr 2008, 9:51 AM
I have this


var panel = new Ext.Panel({
height:120,
layout: 'border',
items: [{
id: 'north',
title: 'north',
region: 'north',
height: 10,
html: ' '
},{
id: 'center',
title: 'center',
region: 'center',
height: 120,
html: '<img src="' + webappContextPath + '/images/loader.gif">'
}]
});
var c = panel.getComponent( 'center' );


panel.getComponent( 'center' ) returns null.

When I look at items using firebug it shows undefined but opening up items I see items.keys has center and north and items.items has the two panels.

TIA

devnull
4 Apr 2008, 9:55 AM
I would guess that the panel needs to be rendered first.

anortje
4 Apr 2008, 10:00 AM
I now all doLayout() - that should render? Still the same.

devnull
4 Apr 2008, 10:03 AM
Not sure then, according to the docs it should be working.
Note that I see very little reason to use this over the global Ext.getCmp('center'), which should also work here.

anortje
4 Apr 2008, 10:11 AM
I got it figured - I had two panels with id='north'. :"> :D

Thanks for taking the time to help.

devnull
4 Apr 2008, 10:16 AM
Wondered if that was gonna be the next question ;)