0

I am using following condition to show data on the page, if the text in the table matches a certain criteria then i have render condition in place that hides that text in the table . However In this code, when field data is hidden , that row is generated and I am getting blank row between two rows.

How to hide this row dynamically

<apex:outputPanel id="theform" rendered="{!AND(NOT(ISBLANK(attachmentList)),attachmentList.size>0)}">
                                                    <br/><span>To view an attached file, select the filename from the left and the action to the right<br/></span>
                                                    <apex:pageblock >
                                                        <apex:pageblockTable value="{!attachmentList}" var="a" border="1" id="pgblk">
                                                            <apex:column headerValue="Action" >
                                                                <apex:outputLink value="{!URLFOR($Action.Attachment.Download, a.Id)}" target="_blank" rendered="{!IF((CONTAINS(a.name,'OpportunityCertificate') && appl.createdbyId = usr.Id && appl.Request_Type__c ='Registration') || (CONTAINS(a.name,'AccountCertificate') && appl.createdbyId != usr.Id && appl.Request_Type__c ='Registration') || (appl.Request_Type__c !='Registration') || (( NOT(CONTAINS(a.name,'AccountCertificate')) && NOT(CONTAINS(a.name,'OpportunityCertificate' ))) && appl.Request_Type__c ='Registration') ,true,false)}">View</apex:outputLink>&nbsp;&nbsp;
                                                                <apex:commandLink value="" action="{!DeleteAttachment}" rendered="{!IF(CONTAINS(a.name,'Certificate') || !(renderFlagforDelete) || CONTAINS(a.name,'AccountCertificate') || CONTAINS(a.name,'OpportunityCertificate') ,false,true)}">
                                                                    <apex:param name="var" value="{!a.id}" assignTo="{!attachmentId}" />Delete
                                                                </apex:commandLink>
                                                            </apex:column>
                                                            <apex:column headerValue="Title" >
                                                                <apex:outputText value="{!a.Name}" rendered="{!IF((CONTAINS(a.name,'OpportunityCertificate') && appl.createdbyId = usr.Id && appl.Request_Type__c ='Registration') || (CONTAINS(a.name,'AccountCertificate') && appl.createdbyId != usr.Id && appl.Request_Type__c ='Registration') || (appl.Request_Type__c !='Registration') || (( NOT(CONTAINS(a.name,'AccountCertificate')) && NOT(CONTAINS(a.name,'OpportunityCertificate' ))) && appl.Request_Type__c ='Registration') ,true,false)}"> 
                                                                </apex:outputText>
                                                            </apex:column>
                                                            <apex:column headerValue="Description">
                                                                <apex:outputText value="{!a.Description}" rendered="{!IF((CONTAINS(a.name,'OpportunityCertificate') && appl.createdbyId = usr.Id && appl.Request_Type__c ='Registration') || (CONTAINS(a.name,'Registration') && appl.createdbyId != usr.Id && appl.Request_Type__c ='Registration') || (appl.Request_Type__c !='Registration') || (( NOT(CONTAINS(a.name,'AccountCertificate')) && NOT(CONTAINS(a.name,'OpportunityCertificate' ))) && appl.Request_Type__c ='Registration') ,true,false)}"> 
                                                                </apex:outputText>
                                                            </apex:column>
                                                        </apex:pageblockTable>
                                                    </apex:pageblock>
                                                </apex:outputPanel>
0

You can use apex to filter out records you don't want to show. As we are setting the list in apex which you show using a page block table, you can filter out records in the attachmentList

For example: (assuming that you have an apex method similar to following)

public List<AttachmentWrapper> getAttachmentList() {
  List<AttachmentWrapper> allAttachments = /* get all attachments to show*/
  List<AttachmentWrapper> atwsFiltered = new List<AttachmentWrapper>();

  for(AttachmentWrapper  aw : allAttachments) {
     /*Apply filter logic - NOTOE: please double check this logic*/
     if(aw.name.contains('OpportunityCertificate') && aw.CreateById == UserInfo.getUserId() && (aw.Request_Type__c == 'Registration' || aw.Name.contains('AccountCertificate')) || ((!aw.Name.contains('AccountCertificate')) && (!aw.Name.contains('Registration'))) {
        atwsFiltered.add(aw);
     }

  }
   return atwsFiltered;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.