tryanDLS
10-31-2006, 07:09 PM
Jack,
Not sure if it's a bug or I'm just mis-using this method. I've chopped off most of the code, hopefully this is enough to make sense. After adding 5 panels to a region, I'm then trying to make something other that the last one active.
var pane =this.layout.getRegion('center').getPanel('centerPane');
var l = pane.layout;
l.beginUpdate();
var t0 = YAHOO.ext.DomHelper.append(document.body, {tag:'t0', frameBorder: 0});
l.add('north', new YAHOO.ext.ContentPanel(t0, {title:'Agency', autoCreate:false}));
l.add('north', new YAHOO.ext.ContentPanel('t1', {title:'Products', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t2', {title:'Marketing', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t3', {title:'Education', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t4', {title:'Reference', autoCreate:true, closable:true}));
l.endUpdate();
So far, so good - everything is build/rendered. Now I try to set the 1st panel active by doing.
l.getRegion('north').setActivePanel('t0');
or
l.getRegion('north').setActivePanel('Agency');
The panel is not found. The way the method looks for a panel when the arg is a string is my problem. I tried creating the panels a couple ways t0 vs t1 above, and neither works. In the case of t0, the id is a generated one, and in the case of t1, it's undefined. Not sure how the 1st line of setActivePanel is supposed to match when it's a string. I suppose if I passed a string '0', JS might return the 1st item, by just convering it to numeric.
Am I off base here? If I'm just not calling it right, let me know.
You might consider another safety check in here regardless of the above. If the panel isn't found, for whatever reason, I don't think the code shouldn't continue and eventually hit a null ref. Maybe just exit without deactivating the initial active panel??
Not sure if it's a bug or I'm just mis-using this method. I've chopped off most of the code, hopefully this is enough to make sense. After adding 5 panels to a region, I'm then trying to make something other that the last one active.
var pane =this.layout.getRegion('center').getPanel('centerPane');
var l = pane.layout;
l.beginUpdate();
var t0 = YAHOO.ext.DomHelper.append(document.body, {tag:'t0', frameBorder: 0});
l.add('north', new YAHOO.ext.ContentPanel(t0, {title:'Agency', autoCreate:false}));
l.add('north', new YAHOO.ext.ContentPanel('t1', {title:'Products', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t2', {title:'Marketing', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t3', {title:'Education', autoCreate:true, closable:true}));
l.add('north', new YAHOO.ext.ContentPanel('t4', {title:'Reference', autoCreate:true, closable:true}));
l.endUpdate();
So far, so good - everything is build/rendered. Now I try to set the 1st panel active by doing.
l.getRegion('north').setActivePanel('t0');
or
l.getRegion('north').setActivePanel('Agency');
The panel is not found. The way the method looks for a panel when the arg is a string is my problem. I tried creating the panels a couple ways t0 vs t1 above, and neither works. In the case of t0, the id is a generated one, and in the case of t1, it's undefined. Not sure how the 1st line of setActivePanel is supposed to match when it's a string. I suppose if I passed a string '0', JS might return the 1st item, by just convering it to numeric.
Am I off base here? If I'm just not calling it right, let me know.
You might consider another safety check in here regardless of the above. If the panel isn't found, for whatever reason, I don't think the code shouldn't continue and eventually hit a null ref. Maybe just exit without deactivating the initial active panel??