1

I have a fairly simple Visualforce page which repeats a component and contains an action function called from within the component:

<apex:form>
    <apex:actionFunction action="{!updateListItems}" name="updateListItems"
                         rerender="fileList">
        <apex:param name="files" assignTo="{!files}" value=""/>
    </apex:actionFunction>
</apex:form>

<apex:pageBlock id="fileListBlock">
    <apex:repeat value="{!docsForUpload}" var="portalDoc">
        <c:MassUpload objId="{!portalDoc.Id}" objName="{!portalDoc.Name}"/>

        <script>
            callUpdateListItems = files => {
                updateListItems(files);
            }
        </script>
    </apex:repeat>
</apex:pageBlock>

The component contains a table which renders the data passed in via objId:

<apex:pageBlockTable value="{!docList}" var="record" id="fileList" rowClasses="odd,even" cellPadding="4" border="0" styleClass="dataTable">
    <apex:column >
        <apex:facet name="header"/>
        <apex:variable var="fTitle"
                       value="{!IF(BEGINS(record.Id, '00P'), record['Name'], record['ContentDocument.Title']
                               + '.' + record['ContentDocument.FileExtension'])}"/>
        <apex:variable var="fId"
                       value="{!IF(BEGINS(record.Id, '00P'), 'Id', 'ContentDocument.LatestPublishedVersionId')}"/>
        <apex:variable var="fDesc"
                       value="{!IF(BEGINS(record.Id, '00P'), record['Description'], record['ContentDocument.Description'])}"/>
        <input type="hidden" class="docInput" name="selected" value="{!record[fId]}" fname="{!fTitle}"
               fdesc="{!fDesc}"/>
    </apex:column>
</apex:pageBlockTable>

I need to rerender just the table, and not the entire component, upon execution of the action function called from the component. I've tried various syntaxes for referencing the fileList ID, but with no luck. I suspect that the repeater is causing problems. What's the secret?

4
  • I'd try either wrapping your pageBlockTable in an outputPanel and rerender that, or just rerender the fileListBlock. From memory, the rerender function rerenders the content inside the element. Which means it won't retrieve your new docList values.
    – Nick C
    Commented Aug 26, 2022 at 0:21
  • Also, what part of this is a lightning component? If you're mixing technologies like this on a visualforce page, you might want to double check that rerendering is actually going to work with this technology mix.
    – Nick C
    Commented Aug 26, 2022 at 0:29
  • Thanks for the response, but more detail in a proper answer would be appreciated. I'm not sure how you propose I rerender an output panel differently from what I'm doing now. As I mentioned, the second code block is most of what's in the component. It is working nicely aside from this issue.
    – isherwood
    Commented Aug 26, 2022 at 13:07
  • Maybe I'm misusing the term. My component is inside the /components directory and uses <apex:component> markup. Is that better referred to as a Visualforce component?
    – isherwood
    Commented Aug 26, 2022 at 13:12

0

You must log in to answer this question.

Browse other questions tagged .