View Full Version : Adding ContentPanels to regions
Animal
7 Nov 2006, 9:33 AM
Each one becomes a tab.
but it's ending up with the last one added as the active one.
I want the first one to be the active one.
How?
tryanDLS
7 Nov 2006, 9:58 AM
Get a ref to the 1st panel and then showPanel
var p0 = your panel
layout.getRegion('north').showPanel(p0);
There also may be another way to do this. I think the latest beta may have added a way to get a panel by index - haven't looked for this yet, to
another way to set focus is to just pass the div id, in this case 'content1'
// assuming you've done the rest of the layout stuff
layout.add('center', new YAHOO.ext.ContentPanel('content1', {title: "Can't Close Me!", closable: false}));
layout.add('center', new YAHOO.ext.ContentPanel('content2', {title: "Please Don't Close Me!", closable: true}));
layout.getRegion('center').showPanel('content1');
jack.slocum
7 Nov 2006, 3:27 PM
And a third way:
var center = layout.getRegion('center');
var p = center.add(new YAHOO.ext.ContentPanel('content1', {title: "Can't Close Me!", closable: false}));
center.showPanel(p);
Animal
8 Nov 2006, 12:23 AM
Thanks - back on track now. showPanel(panelId) is what I was missing!
Animal
8 Nov 2006, 12:37 AM
Get a ref to the 1st panel and then showPanel
var p0 = your panel
layout.getRegion('north').showPanel(p0);
There also may be another way to do this. I think the latest beta may have added a way to get a panel by index - haven't looked for this yet, to
It won't currently retrieve by index.
Modifying this function to read
getPanel : function(id){
if(typeof id == 'object'){ // must be panel obj
return id;
}
return this.panels.get(id);
},
to LayoutRegion.js adds that capability.
jack.slocum
8 Nov 2006, 5:02 AM
Thanks for tracking that down. I appreciate it.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.