PDA

View Full Version : BorderLayout



brant
20 Oct 2006, 12:28 PM
When I call layout.findPanel method it appears that in the BorderLayout.js getContentPanel isn't a function anywhere. Do I just have a wrong version of whats out there?

jack.slocum
20 Oct 2006, 12:41 PM
That's a bug that is now fixed. getContentPanel was renamed to getPanel but findPanel wasn't updated.

brant
20 Oct 2006, 6:00 PM
Thanks Jack,

I'm really liking this border control. I seem to have a problem adding ContentPanels dynamically to the center region. If I add more than one tab I can only access the first and last tab. Of course they are blank panels. This is a piece of code I added,



onNameClick : function(e){
var target = e.findTarget(null, 'a');
if(target) {
var nameId = target.id;
var nameName = target.name;

if( !layout.findPanel( 'name-' + nameId) ) {
layout.add('center', new YAHOO.ext.ContentPanel('name-' + nameId, {title: nameName, closable: true}));
}
}

in the init section:
longList = getEl('longlist');
longList.mon('click', this.onNameClick);


I do something similar with normal tabs. Are you planning on adding support for:

setDefaultUrl and subscribe

the ability to do YAHOO.ext.ContentPanel('name-' + nameId, {title: nameName, closable: true}, 'Some content here');

This controls is great. I'll see what I can add myself and post the diff back.

Thanks!

jack.slocum
21 Oct 2006, 4:53 AM
Do those elements exist that you are adding ('name-' + nameId)?

In my latest dev code I have added the ability to create the panel as well (with config option, create:true).

Right now the panels classes are pretty bare. Adding support for more functionality to the actual panel classes makes sense so everyone isn't writing code that point to the internal structures to make updates (for example pointing to a tabpanelitem to get setUrl functionality). You should definitely be able to do it directly on the ContentPanel object.

I will work on that today. Thanks for the idea.