function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RepsGRepsG 

Rendering PageBlocksectionItem Problem

I would like to render a PageBlockSectionItem based on the previous question. When I encapsulate the PageBlocksectionItem within outputpanel tags, it is not displayed in the way I would like it when I DONT have the PageBlockSectionItem encapsulated in the outputpanel tags.

 

The below code is displayed fine.

<apex:PageBlocksectionitem>

 <apex:outputLabel value="Security Value"/>

 <apex:panelgrid columns="1">

   <apex:outputText value="{!v_opp.Security_value__c}" rendered="false"/>

   <apex:inputField value="{!v_opp.Security_value__c}" id="Security_value__c" />  

 </apex:panelgrid>

</apex:PageBlocksectionitem>

 

 

The when i encapsulate the code within Outputpanel. the field is not displayed as it should.

<apex:outputPanelid="SecurityValue"rendered="{!AND(v_opp.Type_of_Security__c == 'Other')}">

 <apex:PageBlocksectionitem>

  <apex:outputLabel value="Security Value"/>

  <apex:panelgrid columns="1">

    <apex:outputText value="{!v_opp.Security_value__c}" rendered="false"/>

    <apex:inputField value="{!v_opp.Security_value__c}" id="Security_value__c" />  

  </apex:panelgrid>

 </apex:PageBlocksectionitem>

</apex:outputPanel>

 

what I am doing wrong?

Best Answer chosen by Admin (Salesforce Developers) 
RepsGRepsG

Found the solution. You need to encapsulate the code in Page Section before encapusulating it in OutputPanel.

 

<apex:outputPanelid="SecurityValue"rendered="true">

 <apex:PageBlockSection id="test" rendered="{!AND(v_opp.Type_of_Security__c == 'Other')}">

  <apex:PageBlocksectionitem>

   <apex:outputLabel value="Security Value"/>

   <apex:panelgrid columns="1">

     <apex:outputText value="{!v_opp.Security_value__c}" rendered="false"/>

     <apex:inputField value="{!v_opp.Security_value__c}" id="Security_value__c" />  

   </apex:panelgrid>

  </apex:PageBlocksectionitem>

 </apex:PageBlockSection>

</apex:outputPanel>

All Answers

RepsGRepsG

Found the solution. You need to encapsulate the code in Page Section before encapusulating it in OutputPanel.

 

<apex:outputPanelid="SecurityValue"rendered="true">

 <apex:PageBlockSection id="test" rendered="{!AND(v_opp.Type_of_Security__c == 'Other')}">

  <apex:PageBlocksectionitem>

   <apex:outputLabel value="Security Value"/>

   <apex:panelgrid columns="1">

     <apex:outputText value="{!v_opp.Security_value__c}" rendered="false"/>

     <apex:inputField value="{!v_opp.Security_value__c}" id="Security_value__c" />  

   </apex:panelgrid>

  </apex:PageBlocksectionitem>

 </apex:PageBlockSection>

</apex:outputPanel>

This was selected as the best answer
sandeep@Salesforcesandeep@Salesforce

I am also familiar with this problem. 

 

PageBlockSectionItem does not get rendered properly. So in order to refresh this section item  we need to keep this in output panel or need to keep all components of page block setion item in a output pabel and make this output panel as a child of this page blocksection item.