+ Start a Discussion

Component rendering issue with actionFunction


<apex:actionFunction name="viewRepDetail" action="{!callRepDetails}" rerender="repDetail" oncomplete="javascript&colon;displayit();">
<apex:param name="repDetailAcctNbr" assignTo="{!repDetailAcctNbr}" value="{!repDetailAcctNbr}"/>
<div id="repdtldiv">
<apex:outputPanel id="repDetail" layout="block">
<c:SComponent repacctnbr="{!repDetailAcctNbr}" rendered="{!repDetailAcctNbr!=null}"/>



     I have a page which renders component ("SComponent") based on passed param inside actionFunction each time. Upon calling "viewRepDetail" JS function, component renders account information and is opened as overlay, upon closing component, page does not get refreshed. Thus, DOM remains unaltered. While calling "ViewRepDetail" next time, component does not get modified with latest account information and overlay displays old rep account information. Any help would be much appreciated.

Suresh RaghuramSuresh Raghuram

you are rendering , but not doing the rerender.


for example, This just a sample code to make u understand.


<apex:form id ="form1">

<apex:outputText value =" show my values " render=" false" />

</apex: form>


<apex:commandButton value="show" reRender="form1"  action="{!show}"/>


when the page loads value in output text will not display, when you click show button render will set to true.


Similarly check with your java script or with your merge fields.


If this answers your question please mark it as solution.


Not sure you have the same understanding as I am expecting. However, similar to your example code my page does not render anything inside "repDetail" div.  Upon clicking actionFunction thru javascript, it calls component(SComponent) and rerenders component's details( "repDetail" div) based on passed param in action function. 


I think one issue here is with the parameter passed to the actionfunction:


<apex:param name="repDetailAcctNbr" assignTo="{!repDetailAcctNbr}" value="{!repDetailAcctNbr}"/>


This will pass the value of repDetailAcctNbr that was present when the page was originally rendered, so any user selection won't be taken into account.  You should call the actionfunction with the account number that you want to display and leave the value attribute as blank.