PDA

View Full Version : Loading iframe into Panel's body



bhochhi
13 Oct 2010, 12:34 PM
Hello,

Has anyone experienced loading iframe into the panel's body calls the server twice? for instance...

myPanel.update("<iFrame src=\"" + url + "\" height='100%' width='100%' onload='$rend.resizeFrame(this)' scrolling='no' />");

I found that it calls the server twice. Any there any way to get around? using load method calls the server once but as yo know I have to load inside iframe.


thanks in advance.
Bhochhi

Animal
13 Oct 2010, 1:00 PM
Use an iframe AS the panel's body.

This keeps being illustrated here. Condor posted an example just last week.

bhochhi
13 Oct 2010, 2:16 PM
Thank you for the response. My problem is I have an array of panels and "src" of iframe is not available when panels are first loaded. Later, when clicked on header, the panel is expanded with body containing iframe. After checking the posts you have referred and tried to use bodyCfg config on panel but since I don't have src while creating panel, I am wondering how I can feed the src later....

Animal
13 Oct 2010, 9:12 PM
Set the src attribute!

bhochhi
14 Oct 2010, 11:59 AM
Thank you again for quick but short response. I discovered that its not because of update method, but iframe gets loaded again when I expand the panel. Initially all my panels are collapsed. when clicked on panel's header, it expands to show previously loaded iframe. problem is it reloads the iframe again. Also, would tell me how to set the src attribute when I use the iframe as panel's body? I tried with sPanel.body.query('iframe')[0].src, but doesn't seems like this is the way.

ncanton
14 Oct 2010, 12:15 PM
Use an iframe AS the panel's body.

This keeps being illustrated here. Condor posted an example just last week.

I've been scouring the forums but I can't find a working example. Can you provide a link to Condor's example? Thanks.

plalx
14 Oct 2010, 12:41 PM
Examples here (http://www.sencha.com/forum/showthread.php?68266-Ext.Panel-Iframe-for-body-element)

bhochhi
14 Oct 2010, 2:16 PM
This (http://www.sencha.com/forum/showthread.php?111448-Open-HTML-link-in-a-new-tab&highlight=iframe+panel+body) is the one Animal referring to. I checked both of them but couldn't resolved the issue yet. All I found was, when we collapse or expand the panel containing the iframe, The iframe is reloaded accessing the server referred by src attribute.

Animal
14 Oct 2010, 9:11 PM
That has to be a browser bug. collapsing just changes the body element's visibility. I can't see why it would need to reload the document.

bhochhi
15 Oct 2010, 6:48 AM
Yes you are right, collapsing/expanding just changes the body element's visibility. But if you collapse/expand the panel by clicking the panel's header( titleCollapse = true ), I discovered that if body contains the iframe, it reloads the iframe contains by calling the src link.

plalx
15 Oct 2010, 8:06 AM
I confirm that it isin't a browser issue because hiding the frame 'manually' doesn't make it reload.
The reload problem seems to be linked with the animate collaspe logic, since setting animCollapse: false on the panel is fixing the issue. I did not investigate further...

bhochhi
15 Oct 2010, 11:57 AM
yep! animCollapse:false fixed the problem. Thank you Scarsick!!