How to give help text for a Table ?
In visualforce, table can be generated using PageBlockSection, PageBlockTable, DataGrid tags. If one wants to provide help text for a column, they need to use apex:facet tag.How it will be useful to indicate Required Field ?
In some cases, developer may want to indicate a column as Required. So, it's possible to provide that in the table column header
Where is the Code ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page standardController="Opportunity" recordSetVar="Opps"> | |
<style> | |
.ReqHelpText { | |
display : inline-block; | |
width : 3px; | |
background-color : #c00; | |
} | |
</style> | |
<apex:sectionHeader title="Opportunities"/> | |
<apex:form> | |
<apex:pageBlock> | |
<apex:pageBlockTable value="{!Opps}" var="opp"> | |
<apex:column> | |
<apex:inputField value="{!Opp.Name}"/> | |
<apex:facet name="header"> | |
<apex:outputPanel> | |
<apex:outputText value="Opportunity Name - "/> | |
<apex:outputText value=" " escape="false" styleClass="ReqHelpText"/> | |
<apex:outputText value=" It is a Required Field"/> | |
</apex:outputPanel> | |
</apex:facet> | |
</apex:column> | |
<apex:column value="{!Opp.StageName}"/> | |
<apex:column value="{!Opp.IsClosed}"/> | |
</apex:pageBlockTable> | |
</apex:pageBlock> | |
</apex:form> | |
</apex:page> |
No comments:
Post a Comment
Thanks for reading my blog !