Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am trying to display a text label and check box side by side as a column header in an <apex:pageBlockTable>. Below is my code where I am trying to achieve this:

<apex:page standardController="Account" recordSetVar="accList">
  <apex:pageBlock >
      <apex:form >
          <apex:pageBlockTable value="{!accList}" var="acc">
              <apex:column value="{!acc.name}">
                  <apex:facet name="header">{!$Label.Name}<apex:inputCheckbox /></apex:facet>
              </apex:column>
          </apex:pageBlockTable>
      </apex:form>
  </apex:pageBlock>
</apex:page>

But on the header only check box is displayed and not the label. Please help me on this.

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You have the wrong format for the label merge field, hence nothing is being displayed. If you used <apex:outputLabel value="{!$Label.Name}"/> you'd see the error. The value you're trying to display is for custom labels that are defined at an org level.

You can fix this by using {!$ObjectType.Account.Fields.Name.Label}.

That said, if you are trying to use a custom label, or the account name field's label, both cases require that you use an <apex:outputPanel> tag inside the facet to group the components together like so:

<apex:facet name="header">
  <apex:outputPanel layout="none">
    <apex:outputLabel value="{!$ObjectType.Account.Fields.Name.Label}"/><apex:inputCheckbox />
  </apex:outputPanel>
</apex:facet>
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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