0

I like to render an iFrame in my page if some batches are done. But only like to render it once.

what I tried before, makes it rerendering all 5 seconds:

<apex:form >
    <apex:actionPoller rerender="iFrame,someOthers" interval="5" action="{!updateProgress}" />
    <apex:someCode id="someOthers"/>
    <apex:iframe src="{!frameUrl}" id="iframe" height="50px" width="100%" rendered="{!loadFrame}" />
</apex:form>

So What I'm looking for should do something like:

if (someWorkDone && iFrame is not shown yet)
    iFrame rendered = true; (but never rerender it)

EDIT: Solution with help of Adrian & Tim:

<apex:outputPanel id="container">
    <apex:form>
        <apex:actionPoller rendered="{!NOT(frameShown)}" rerender="container" interval="5" action="{!updateProgress}" />
        <apex:actionPoller rendered="{!frameShown}" rerender="someOthers" interval="5" action="{!updateProgress}" />
        <apex:someCode id="someOthers"/>
        <apex:iframe src="{!frameUrl}" id="iframe" height="50px" width="100%" rendered="{!frameShown}" />
    </apex:form>
</apex:outputPanel>

1 Answer 1

3

If you give your <apex:form> tag an id, you can rerender that and have updateProgress set some sort of flag variable. Something like:

<apex:form id="apexForm">
    <apex:actionPoller rendered="{!alreadyRerendered}" rerender="someOthers" interval="5" action="{!updateProgress}" />
    <apex:actionPoller rendered="{!NOT(alreadyRendered)}" rerender="apexForm" interval="5" action="{!updateProgress}" />
    <apex:someCode id="someOthers"/>
    <apex:iframe src="{!frameUrl}" id="iframe" height="50px" width="100%" rendered="{!loadFrame}" />
</apex:form>

Then just have your updateProgress method setalreadyRendered = true.

3
  • 1
    I've seen ie compatibility issues rerendering the form. You might be better off wrapping the contents of the from in an outputPanel with an id and rerendering it.
    – Tim Smith
    Commented Aug 3, 2013 at 18:21
  • Absolutely. I just wanted to minimize the number of tweaks I made in my code.
    – Adrian Larson
    Commented Aug 5, 2013 at 16:14
  • All right, thanks both of you, I gonna upload my answer, i was able to reduce size of variables to 1.
    – itsmebasti
    Commented Aug 5, 2013 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .