3

i have one apex:component and added it into visualforce page. and from there i want to refresh or say rerender that component based on contact id.

following logic i wrote but its not getting updated based on contact id.

visual force page :

<apex:pageBlockSectionItem >
       <apex:outputLabel value="Who to Bill"/>
               <apex:selectList size="1" value="{!whoToBillSelected}">
                        <apex:selectOptions value="{!contacts}"/>
                        <apex:actionSupport event="onchange" action="{!selectGuestOrMember}" rerender="updateThis"></apex:actionSupport>
               </apex:selectList>
</apex:pageBlockSectionItem>
<apex:outputPanel id="updateThis" >
        <apex:outputLabel value="Payment Method's"/>
            <c:C62PaymentComponent mode="Choose" showTemporary="false" sObjectId="{!contact_id}">
            </c:C62PaymentComponent>
{!contact_id}
</apex:outputPanel>

so when i select any other value from "who to bill" select list i want to refresh "updateThis" output panel. now i have added variable "contact_id" which gives us contact id dynamically. i printed that as well after component. same variable i passed into component as well. and when i change the value from list then this variable print id of whatever contact i select but component is not getting updated. i want to know if i am doing anything wrong here?

thank you in advance.

1

actually i couldnt find any answer to refresh only component so what i did is used page reference and refreshed the page with setRedirect = false.

this way i got whole page refreshed with no data lost which is already filled on that page and i got to refresh component as well yehheee... :D

following i did in controller when action support call "selectGuestOrMember" this function.

public PageReference selectGuestOrMember(){
        PageReference pageRef = new PageReference('/apex/page');
        pageRef.setRedirect(false);
        pageRef.getParameters().put('id',ApexPages.currentPage().getParameters().get('id'));
        return pageRef;
}

and it worked for me..

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.