You need to sign in to do that
Don't have an account?
Joe Hayes
Header disappears when rendered attribute is used in apex:column
Hi,
I have a visulaforce page that displays a table of records from a related list.
I have used the rendered attribute to only display certain records (rows)
This all works fine however the column headers are not showing, Would anybody be able to see why?
Thanks
Joe
I have a visulaforce page that displays a table of records from a related list.
I have used the rendered attribute to only display certain records (rows)
This all works fine however the column headers are not showing, Would anybody be able to see why?
<apex:pageBlock title="Delegates"> <apex:dataTable value="{!Courses__c.Delegates__r}" var="item" border="1" cellpadding="5" cellspacing="1"> <apex:column style="width:20%" rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Name</apex:facet> {!item.Name} </apex:column> <apex:column style="width:30%" rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Signature</apex:facet> </apex:column> <apex:column style="width:20%" rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Company Name</apex:facet> {!item.Contact__r.Account.Name} </apex:column> <apex:column style="width:30%" rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Email Address</apex:facet> </apex:column> <apex:column rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Exam Board</apex:facet> {!item.Exam_Board__c} </apex:column> <apex:column rendered="{!item.Status__c == 'Booked'}"> <apex:facet name="header">Number of Days</apex:facet> <table border="1" cellpadding="5" cellspacing="0"> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <td>5</td> </table> </apex:column> </apex:dataTable> </apex:pageBlock>
Thanks
Joe
I belive there is some issue with apex:datatable column rendering while using conditional rendered statements like yours. Use some concrete true and false values.
Replace : With some thing like. You can achieve someting like this using wrapper classes.
Have a look to it.
I managed to sort it with this:
It's a longer code, but it works.
Thanks
In ER.Value_5__c I have the value of 0. However the code above hides the header
In ER.Value_6__c I have no value (should be null). However the header displays
In ER.Value_7__c I have no value (should be null). The header and value do not display.
I need to hide the entire column if say ER.Value_5__c has no value. I cannot get it to work for the life of me.