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
kabkab 

Either check box or Text not both on the table header

 

I am trying to add on header checkbox, where I can select All  the row check boxes by clicking on the header

Using the following code.

<apex:column > 

<apex:facet name="header1"><apex:outputLabel value="Select All" for="select_All_Check"/></apex:facet>

<apex:facet name="header2"><apex:inputCheckbox  id="select_All_Check"></apex:inputCheckbox></apex:facet> <apex:inputField id="Selectd_Row" value="{!con.Field__c}" /> 

</apex:column>

It is not displaying both checkbox and text.  is there anything wrong in my code?

 

Thank you.

Best Answer chosen by Admin (Salesforce Developers) 
mtbclimbermtbclimber

Here's some code based on what you provided above, I didn't test it but hopefully it will give you the idea.

 

 

 

<apex:column> 
    <apex:facet name="header">
        <apex:outputPanel>
            <apex:outputLabel value="Select All" for="select_All_Check"/>
            <apex:inputCheckbox id="select_All_Check"/>
        </apex:outputPanel>
    </apex:facet>
    <apex:inputField id="Selectd_Row" value="{!con.Field__c}" /> 
</apex:column>

 

 

All Answers

mtbclimbermtbclimber

There is only one facet named "header" you can't create multiple.  Create one and then put the label and the checkbox in that single facet. If memory serves you may have to nest them in one component like an outputPanel.

kabkab

Thanks Andrew . I tried changing all different way but did not work.Can you pl. put a sample what you mean by nesting in the header using output panel?

 

mtbclimbermtbclimber

Here's some code based on what you provided above, I didn't test it but hopefully it will give you the idea.

 

 

 

<apex:column> 
    <apex:facet name="header">
        <apex:outputPanel>
            <apex:outputLabel value="Select All" for="select_All_Check"/>
            <apex:inputCheckbox id="select_All_Check"/>
        </apex:outputPanel>
    </apex:facet>
    <apex:inputField id="Selectd_Row" value="{!con.Field__c}" /> 
</apex:column>

 

 

This was selected as the best answer