PDA

View Full Version : Problem with removing a panel



jbowman
11 Nov 2006, 5:20 PM
removing a tabbed item from a contentpanel is causing the whole region to disappear?

I have a layout that's set up like this -



headerLayout.beginUpdate();
headerLayout.add('west', new YAHOO.ext.ContentPanel('logo', {fitToFrame:true}));
headerLayout.add('center', new YAHOO.ext.ContentPanel('nav', {title: "Navigation", fitToFrame:true}));
headerLayout.add('east', new YAHOO.ext.ContentPanel('login', {fitToFrame:true}));
headerLayout.getRegion('center').showPanel('nav');
headerLayout.endUpdate();


On user log in, this happens



if (!headerLayout.getRegion('center').getPanel('alerts'))
{
if ( !document.getElementById('alerts'))
{
var alerts = document.createElement("div");
var alertstext = document.createTextNode("0 new messages 0 new comments 0 friends online");
alerts.appendChild(alertstext);
alerts.class = "ylayout-inactive-content";
alerts.id = "alerts";
document.getElementById('header').appendChild(alerts);
}
headerLayout.beginUpdate();
headerLayout.add('center', new YAHOO.ext.ContentPanel('alerts', {title: "Alerts", fitToFrame:true}));
headerLayout.endUpdate();
}


And when a user log outs, I have this set



if (headerLayout.getRegion('center').getPanel('alerts'))
{
headerLayout.beginUpdate();
headerLayout.getRegion('center').remove('alerts');
headerLayout.endUpdate();
headerLayout.getRegion('center').showPanel('nav');
}



The problem is when the user logs out, the whole region turns blank, instead of displaying the nav panel.

jarrednicholls
11 Nov 2006, 5:47 PM
i've posted about a similar problem, although it doesn't appear to be the same problem. This may be fixed w/ RC2 that Jack's no doubt compiling and working on as we speak...aside from his nifty javascript documentation thing.

jack.slocum
11 Nov 2006, 5:56 PM
Can you put up a link for me to see it? It will make it easier to fix out what's going on.

FYI, your "alerts" creation could b shortened to this:


if(!headerLayout.getRegion('center').hasPanel('alerts')){
headerLayout.add('center', new YAHOO.ext.ContentPanel('alerts', {
title: "Alerts", fitToFrame:true,
autoCreate: {
tag: 'div',
html: '0 new messages 0 new comments 0 friends online'
}
});
}

jbowman
11 Nov 2006, 6:02 PM
sure, give me about 10 minutes to update the code on my host, you may want to view it in firefox, there's another bug that's causing IE 6 to not play nice that I'm working on right now.

jbowman
11 Nov 2006, 6:07 PM
http://whasit.com/ci/

There's a generic account with the username "testorg" and password "testorg!" (minus the quotes) you can use.

jbowman
11 Nov 2006, 6:14 PM
actually, that problem with the panel going blank looks like it's firefox specific, I'm using version 1.5.0.8

jack.slocum
11 Nov 2006, 6:34 PM
I can't make my panels disappear locally which means it probably has something to do with this problem (which is fixed):

http://www.jackslocum.com/forum/viewtopic.php?t=675

jbowman
11 Nov 2006, 6:45 PM
oki doki, I'll wait RC2 then :)

jbowman
11 Nov 2006, 8:27 PM
hey Jack, just so you know the problem has gone away for me on my development box with me setting alwaysShowTabs to true on that region.