I have a Visualforce component (apex:component
) where I would like to trigger the rerendering of an apex component on the containing page. In this case the component to rerender is an apex:pageBlockButtons
, but it could equally be an apex:outputPanel
.
Page
<apex:page showHeader="true" sidebar="true" controller="AdBookInventoryCheckController">
<apex:Form id="theForm">
<!-- ... -->
<apex:pageBlockButtons id="pAddFilterButton">
<apex:commandButton action="{!addFilter}" value="Add Filter" id="theButton" disabled="{! addFilterButtonDisabled }" />
<apex:outputText value="{!NOW()}" /> <!-- Just for debugging -->
</apex:pageBlockButtons>
<!-- ... -->
<c:TheComponent id="pbsPosition" />
<!-- ... -->
</apex:Form>
</apex:page>
Component
<apex:component controller="TheComponentController" >
<apex:outputPanel id="pl1">
<apex:outputPanel id="pl1">
<apex:SelectList value="{!pl1Sel}" size="1">
<apex:actionSupport event="onchange" action="{!changePl1}" rerender="pl,pAddFilterButton" status="counterStatus1"/>
<apex:selectOptions value="{!pl1}"></apex:selectOptions>
</apex:SelectList><apex:actionStatus startText=" Loading..." id="counterStatus1"/><br/>
</apex:outputPanel>
</apex:outputPanel>
</apex:component>
Directly using the pAddFilterButton
id in the actionSupport rerender attribute doesn't cause the pageBlockButtons to rerender.
I've also tried some of the ideas from Rerender Visualforce Parent Component Panels from another component around passing the page components Id to the Visualforce component via an attribute. None of the following worked:
- Just the component id:
pAddFilterButton
- The $Component notation:
{!$Component.pAddFilterButton}
- The colon separated path:
mediaPageBlock:mediaForm:pAddFilterButton
How can I get an action in the component to cause an Ajax update to the parent page?