1

I have a visualforce page that is being rerendered. It contains 2 sections:

  • First section contains a list of child records using the OOTB syntax (not sure what to call it)
  • Second section contains a list of child records using a SOQL query in the extension

I've confirmed the rerender is working, but it only works on the child records driven by the extension's SOQL query.

Code snipet:

<apex:page standardController="MyParentObject__c" extensions="MyParentObjectExt">
    <apex:form id="theForm">
        <apex:actionFunction action="{!MyActionMethod}" name="MyActionMethod" rerender="dataPanel" />

        <apex:pageBlock id="thePageBlock">
            <apex:outputPanel id="dataPanel" layout="block">
                {!now()} <!-- to show the panel is rerendering -->

                <!-- uses the OOTB relationship to the child records -->
                <apex:pageBlockSection>
                    <apex:pageBlockTable var="thisChild" value="{!MyParentObject__c.My_Childs__r}">
                        ... column data ommited for brevity ...           
                    </apex:pageBlockTable>
                </apex:pageBlockSection>

                <!-- Uses an extension mehod the returns a list of My_Child__c records -->
                <apex:pageBlockSection>
                    <apex:pageBlockTable var="thisChild" value="{!MyExtensionMethod}">
                        ... column data ommited for brevity ...           
                    </apex:pageBlockTable>
                </apex:pageBlockSection>

             </apex:outputPanel>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Does anyone know why the OOTB relationship syntax doesn't rerender, and whether there's a way to get it to rerender?

I'd much rather use the OOTB way, meaning I don't need an extension, and I don't have to synchronise my SOQL query with the fields displayed on the page.

1 Answer 1

1

The built-in query mechanism queries only once, when the page is initially loaded. It has nothing to do with reRender or anything else. If you need the data to be updated each time, you need to fully reload the page via window.location.reload(true), or by redirecting back to the page to cause a full refresh.

<apex:commandButton action="{!URLFOR($Page.myPage,MyParentObject__c.Id)}" value="Refresh" />
1
  • Thanks @sfdcfox. I was hoping there'd be a way to rerender the built-in query mechanism.
    – Nick C
    Commented Apr 23, 2018 at 4:53

You must log in to answer this question.

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