+ Start a Discussion
Chiel de Graaf.Chiel de Graaf. 

hide rows in Apex:column

Hi all,

I have this VF page, which displays some fields in columns, rendered by a field value.
The only problem i encounter is that the records that are not shown because of the rendering, sstill produce a blank line.
How do i get the blank lines to not show up on the VF page.

This is de code
<apex:page standardController="Discount__c" recordSetVar="Discounts" >
   <apex:form >
   <apex:pageBlock rendered="{!If(Discount__c.Status__c !='Draft', true, false)}" title="Draft discounts">
        <apex:pageBlockTable value="{!Discounts}" var="a" >
        <apex:column headerValue="Name">        
        <apex:outputLink rendered="{!If(a.Status__c =='Draft', true, false)}" target="_blank" value="/{!a.id}">{!a.Name}</apex:outputLink>
        </apex:column>
        <apex:column headerValue="Status">
        <apex:outputText value="{!a.Status__c}" rendered="{!If(a.Status__c =='Draft', true, false)}"></apex:outputtext>
        </apex:column>
        <apex:column headerValue="API">
        <apex:outputText value="{!a.APIPartner__r.Name}" rendered="{!If(a.Status__c =='Draft', true, false)}"></apex:outputtext>
        </apex:column>
        <apex:column headerValue="MP User">
        <apex:outputText value="{!a.MP_User__r.Name}" rendered="{!If(a.Status__c =='Draft', true, false)}"></apex:outputtext>  
        </apex:column>
        <apex:column headerValue="Ingansdatum">
        <apex:outputText value="{0,date,dd'/'MM'/'yyyy}" rendered="{!If(a.Status__c =='Draft', true, false)}">
        <apex:param value="{!a.Discount_Start_Date__c}" /> 
        </apex:outputText>
        </apex:column>
        <apex:column headerValue="Ingediend door">
        <apex:outputText value="{!a.CreatedBy.Name}" rendered="{!If(a.Status__c =='Draft', true, false)}"></apex:outputtext>  
        </apex:column>
      </apex:pageBlockTable>
    </apex:pageBlock>
   </apex:form>         
</apex:page>
And this the output with the empty rows

User-added image

Regards
Chiel
Best Answer chosen by Chiel de Graaf.
DeveloperSudDeveloperSud
Hi ,

Use a custom controller and fetch all the required data that you want to show in that pageblock table from the controller method.If you will use inline if-else statement the gap will appear as the row is not displaying that record as it is not satisfying the condition.Hope this will help.If u need anything else post it here otherwise mark it as solved.Thanks

All Answers

DeveloperSudDeveloperSud
Hi ,

Use a custom controller and fetch all the required data that you want to show in that pageblock table from the controller method.If you will use inline if-else statement the gap will appear as the row is not displaying that record as it is not satisfying the condition.Hope this will help.If u need anything else post it here otherwise mark it as solved.Thanks
This was selected as the best answer
Chiel de Graaf.Chiel de Graaf.
Hi,

Thank you for the reply.
Already feared this answer.
So i need to get some Apex querying skills to get this solved.
DeveloperSudDeveloperSud
Hi,

yes,seems this is the only solution of it.Mark it as solved if this answer your query.