PDA

View Full Version : double request for one contentpanel in borderlayout



stonecracker
15 Nov 2006, 8:33 AM
var iframe = YAHOO.extDomHelper.append(document.body, {id:somePanelId, tag: 'iframe', src: someLink});
layout.add('center', new YAHOO.ext.ContentPanel(iframe, {title: something});

The code demonstrated above is a common usage of the contentpanel in borderlayout and I found there are actual TWO request send to server instead of one.

remove
src: someLink and explictly add the following after the last line will generate only one request:

iframe.src = someLink;

Is it bug or something I'm missing?

PS: Congratulations to the new domain and new site:)

jack.slocum
15 Nov 2006, 8:38 AM
It could be related to moving the node in the DOM. There's no way to get around that though. It's good to know though since the new docs center uses very similar code. :)

stonecracker
15 Nov 2006, 8:05 PM
Thanks for your information, jack.

There is another behavior of contentpanel may link to this:

Add two tab containing iframe and then close one of them, the other will reload from the server rather than move from the original dom already loaded.

jack.slocum
15 Nov 2006, 9:08 PM
Is that on Safari? If yes, Safari reloads the iframe when switching from display:none to display:block. I'm not sure why. Does your workaround also fix that?

stonecracker
15 Nov 2006, 11:22 PM
It's in FF2 and I have no fix for this because of timing. I added a unclosable panel with a empty title shows some static content, which I found is also very useful for my application. I surely will go deeper when I have time to do so.