+ Start a Discussion
PronowPronow 

Apex:ouputPanel rerender problem

Hello there,

 

I have a strange problem with <apex:outputPanel>, rendered="" attribute. In my controller, I have an Integer variable. On first load of the VF page, the value is non-negative. I have a search functionality, that causes to call {!onLoad} method. This method makes the value to 0(zero).  Now, when I try to rerender that outputPanel, its does't re-render even though the value of the variable is zero or negative.

 

Please help.

 

Thank you in advance.

 

This is VF <apex:outputPanel> :

 

<apex:outputpanel rendered="{!IF(volResultSide > 0, false, true)}">
<tr class="EvenRow" height="40px" style="padding-top:16px;padding-left: 15px;padding-right: 4px">
<td class="column">No Volunteers found!</td>
</tr>
</apex:outputpanel>

Best Answer chosen by Admin (Salesforce Developers) 
BharathimohanBharathimohan

Hi Pronow,

 

Try this,

 

<apex:outputpanel id="tryrerenderingthis">

<apex:outputpanel rendered="{!IF(volResultSide > 0, false, true)}">
<tr class="EvenRow" height="40px" style="padding-top:16px;padding-left: 15px;padding-right: 4px">
<td class="column">No Volunteers found!</td>
</tr>
</apex:outputpanel>

</apex:outputpanel>

 

wrap your code with an extra outputpanel and try to re-render the first output panel which is "tryrerenderingthis" .

 

 

Regards,

Bharathi
Salesforce For All

Mark this post as solved, if it helps you

 

 

All Answers

sunil_kumarsunil_kumar

Hi Pronow,

 

If your <apex:outputpanel> is present within <apex:pageblock> then you need to provide pageblock id in rerender attribute of commanbutton instead of apex:outputpanel id. You can also provide <apex:form> id in rerender attribute. Rerender attribute define which portion of VF page will get refresh from server. If you won't provide rereder attribute in commandbutton then your whole page will refresh from server and you will get expected output. Below is sample code

 

<apex:page controller="test23">
<apex:form >
<apex:pageblock id="pg">
<apex:outputpanel rendered="{!IF(volResultSide > 0, false, true)}" id="tt">
sunil kumar
</apex:outputpanel>
</apex:pageblock>
<!--<apex:commandButton value="test" action="{!test}" reRender="tt"/> this will not work-->
<apex:commandButton value="test" action="{!test}" reRender="pg"/>
</apex:form>
</apex:page>

 

Hope this will help you.

[If it solves your problem, please mark it as solution]

 

BharathimohanBharathimohan

Hi Pronow,

 

Try this,

 

<apex:outputpanel id="tryrerenderingthis">

<apex:outputpanel rendered="{!IF(volResultSide > 0, false, true)}">
<tr class="EvenRow" height="40px" style="padding-top:16px;padding-left: 15px;padding-right: 4px">
<td class="column">No Volunteers found!</td>
</tr>
</apex:outputpanel>

</apex:outputpanel>

 

wrap your code with an extra outputpanel and try to re-render the first output panel which is "tryrerenderingthis" .

 

 

Regards,

Bharathi
Salesforce For All

Mark this post as solved, if it helps you

 

 

This was selected as the best answer