Salesforce VF page: apex:repeat returns data and blank fields

apexpdfvisualforce

I have a record that has 4 recordTypes. Each recordType has a description field(s). I'm currently using the code below to display the description field(s) but I can't get rid of the extra blank fields at the end.

<apex:repeat value="{!evt.CPCMs__r}" var="const">
<div class="slds-m-bottom_small" style="border: 1px solid #006600; min-height: 10px; display: {!If(const.recordtype.name!='Consequence', 'none', '')};">
<apex:outputText styleClass="body-text" value="{! If(const.recordtype.name == 'Consequence' && const.GRA_RR_CPCM_Container__c == container.Id, const.GRA_RR_Description__c,'')}" />
</div>
</apex:repeat>

Best Answer

Note that you are outputting something of value conditionally otherwise, you are outputting just empty value. Since you have div repeats for each outblock, it will show up as div with empty output field.

You might want to use render attribute on div tag to hide that block. See this help for more info on how to conditionally render.

Related Topic