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

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" />
  • Thanks @sfdcfox. I was hoping there'd be a way to rerender the built-in query mechanism. – Nick Cook Apr 23 '18 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.