+ Start a Discussion
Keith987Keith987 

Can reRender be used where apex:repeat is being used to define order of parts of a Visualforce page?

<apex:repeat value="{!sectionOrder}" var="order">
    <apex:outputPanel layout="none" rendered="{! order == 'Reference' }">
        <apex:pageBlock title="Reference">
            <apex:pageBlockButtons location="top">
                <apex:commandButton reRender="??? what goes here to get the EligibilityPageBlock re-rendered ???"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:outputPanel>
    <apex:outputPanel layout="none" rendered="{! order == 'Synopsis' }">
        <apex:pageBlock title="Synopsis">
        </apex:pageBlock>
    </apex:outputPanel>
    <apex:outputPanel layout="none" rendered="{! order == 'Eligibility' }" id="EligibilityOutputPanel>
        <apex:pageBlock title="Eligibility" id="EligibilityPageBlock">
        </apex:pageBlock>
    </apex:outputPanel>
    <!-- More similar panels -->
</apex:repeat>

The above illustrates how I am controlling the order that some apex:pageBlocks are output by having a sectionOrder list provided by the controller. Introducing this re-ordering has however broken some reRender logic that I had, perhaps because the full ids in the generated page now include the apex:repeat index of 0, 1, 2 etc.

 

I am unclear about how the id supplied in reRender is resolved back to the full id in the page. Any insight into whether there is a way to get partial page re-rendering to work in the above situation would be appreciated.

 

Thanks,

Keith

Anup JadhavAnup Jadhav

Just put the following to get this working:

 

<apex:commandButton reRender="{!$Component.EligibilityPageBlock}"/>

 Hopefully, the above code block will resolve your issue.

 

Thanks,

Anup

Keith987Keith987

Found this thread Repeat Component and AJAX that discusses the issue and suggests the best that can be done is to specify the id of the apex:repeat element and that is what I have done. This does result in the re-rendering working.

 

But bizzarely, when the AJAX server request causes a message to be added using ApexPages.addMessage(new ApexPages.Message(...)), the view state size doubles resulting in the "Maximum view state size limit (135KB) exceeded." error message. (Without the apex:repeat adding the same message adds 2k to the view state.) So I am still stuck for a solution.

 

My attempts to rerender particular children of the repeat, including adding the repeat index into the id, failed.

 

PS Gave up on using apex:repeat and did some client-side DOM manipulation instead to work around the problems. Yuk.