Tuesday, July 29, 2014

Rendering problem in visualforce pages

Some time we face problem that some section is not getting re-rendered even if we are re-rendering the section from some action from my experience I have learned most of the time it stop working on the below reasons

1) We are trying to render a pageBlock or pageBlockSection 
2) We have some rendered condition on the section

Solution for point 1 is put an outputPanel and re-render it

<apex:outputPanel id="panel1">
 <apex:pageBlock> ....
</apexoutputPanel>
<apex:actionFunction reRender="panel1">

Solution for point 2 is put an outputPanel and re-render it

<apex:outputPanel id="panel1">
<apex:outputPanel rendered ={condition}>
 <apex:pageBlock> ....
</apexoutputPanel>
</apexoutputPanel>
<apex:actionFunction reRender="panel1">

The reason behind it if we have a rendered condition and the condition became false there is no html outcome hence VF page fails to re-render on second attempt as there is no DOM element for that 

No comments:

Post a Comment

Tips on passing Salesforce AI Associate Certification

  🌟 Motivation to Pursue the Salesforce AI Associate Certification 🌟 The world of technology is in a state of perpetual evolution, and on...