function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jina ChetiaJina Chetia 

How to hide the dispaly of column header if the list has no elements?

Hi,

I have a table which is iterating through an Account List and suppose my list has no accounts, it does not display any table but displays the header of the column. I am using the apex:dataTable and headerValue attribute of apex:column. I don't want the column header to pop up when the list is emplty.How do I achieve that?

Code:
  <apex:dataTable value="{!hiROC}" var="a" id="rows">
                        <apex:column headerValue="Greater than $">
                        <apex:inputField value="{!a.Greater_Than__c}" required="false"/></apex:column>
                        <apex:column headerValue="BPS in Rate Adjustment(+/-)">
                        <apex:inputField value="{!a.BPS_in_Rate_Adjustment__c}" required="false"/></apex:column>
                  </apex:dataTable> 

 Regards,
Jina

TehNrdTehNrd
Don't render the table if the list has no elements:

Code:
<apex:dataTable value="{!hiROC}" var="a" id="rows" rendered="{!showTable}">

public boolean getShowTable(){
    boolean show = true;
    if(gethiRoc().size() == 0){
        show = false;
    }
}

 



Message Edited by TehNrd on 06-03-2008 09:06 AM
Jina ChetiaJina Chetia
I have a 'Add' button below the table and if I use rendered, the Add button does not work.
jwetzlerjwetzler
Then move the rendered attribute/logic to each of the columns?