[SalesForce] Visualforce Display and Hide Fields

I wrote a visualforce page using a wrapper class. Everything is displaying just the way I want it for the most part. I was trying to figure out how to display columns within my pageblock on conditions however my format gets all messed up. I was referencing this: https://www.forcetalks.com/salesforce-topic/how-can-we-create-a-dynamic-checkbox-on-visualforce-page/
however when I try to use the pageblockSectionItem Rendered un-formats my 3rd page block section and makes it all smashed together and some fields do not display. What I want to do is if H.Found__c = yes then display some additional fields from my lstHost(which is an object that I am querying. )

I can show my controller if need be. Any help would be appreciated.

<apex:page sidebar="false" standardController="Quote__c" extensions="FormExtension" showHeader="true">
<apex:form >



<apex:pageBlock >
        <apex:pageblocksection columns="2">

            <apex:outputField value="{!Quote__c.name}"/>
            <apex:outputField value="{!Quote__c.Status__c}"/> 

        </apex:pageBlockSection>

    <apex:pageBlockTable value="{!records}" var="Q"> 
   <apex:column >

         <apex:pageblockTable value="{!Q.lstHost}" var="H">
                <apex:column value="{!H.Name}"/>
                <apex:column value="{!H.Product_Brand__c}"/>

                <apex:column> 
                <apex:inputField value="{!H.Found__c}" required="true">
                </apex:inputField> 
                </apex:column>

                <apex:column >

                        <apex:pageBlockTable value="{!H.Assets__r}" var="A">
                            <apex:column value="{!A.Brand__c}"/>
                            <apex:column value="{!A.Model__c}"/>

                              <apex:column value="{!A.Order__c}"/>
                            <apex:column value="{!A.SerialNumber}"/>

                        </apex:pageBlockTable>
                </apex:column>
            </apex:pageblockTable>
        </apex:column>

</apex:pageBlockTable> 
</apex:pageBlock>

<apex:pageBlock >  
      <apex:pageBlockSection columns="1">
     <apex:pageBlockTable value="{!AFields}" var="Additional">

        <apex:column headerValue="Product">
            <apex:inputField value="{!Additional.Product__c}"/>
        </apex:column>
          <apex:column headerValue="End Config">
            <apex:inputField value="{!Additional.End_Config__c}" style="width:95%;"/>
        </apex:column>
         <apex:column headerValue="Current Configuration">
            <apex:inputField value="{!Additional.Config__c}" style="width:95%;"/>
        </apex:column>


    </apex:pageBlockTable>
     </apex:pageBlockSection>

Best Answer

You could remove apex:PageBlockSection and then add rendered condition in apex:column for 3rd pageBlockTable as follows

<apex:pageBlock>  
     <apex:pageBlockTable value="{!AFields}" var="Additional">
        <apex:column headerValue="Product">
            <apex:inputField value="{!Additional.Product__c}"/>
        </apex:column>
          <apex:column headerValue="End Config">
            <apex:inputField value="{!Additional.End_Config__c}" style="width:95%;"/>
        </apex:column>
         <apex:column headerValue="Current Configuration" rendered={!your condition}">
            <apex:inputField value="{!Additional.Config__c}" style="width:95%;"/>
        </apex:column>
    </apex:pageBlockTable>
</apex:pageBlock>
Related Topic