You need to sign in to do that
Don't have an account?
Right Aligning a Header in datatable
Hi
How can I right-align my header items in a datatable (as in the code below)
<apex:dataTable value="{!opportunity.opportunitylineitems}" var="line" rowClasses="odd,even" columnsWidth="550px, 60px, 100px, 100px, 100px"> <td><apex:column width="390px" ><apex:facet name="header">Description</apex:facet><apex:outputField value="{!line.PricebookEntry.name}"/></apex:column> <td><apex:column style="text-align:right" width="60px"><apex:facet name="header" >Quantity</apex:facet> <apex:outputField value="{!line.Quantity}"/></apex:column></td> <apex:column style="text-align:right" width="100px"> <apex:facet name="header" >Initial Fee</apex:facet><apex:outputText value="{0,number,R #,###.00}"> <apex:param value="{!line.UnitPrice}" /> </apex:outputText></apex:column> <apex:column style="text-align:right" width="100px"> <apex:facet name="header" >Est. Annual Fee</apex:facet><apex:outputText value="{0,number,R #,###.00}"> <apex:param value="{!line.UnitPrice}" /> </apex:outputText></apex:column> <apex:column style="text-align:right" width="100px" ><apex:facet name="header" >Total Price</apex:facet> <apex:outputText value="{0,number,R #,###.00}"> <apex:param value="{!line.TotalPrice}" /> </apex:outputText></apex:column> </apex:datatable>
Many thanks
Ross
Hi,
You can set the right align by using the below code in <apex:colum> tag
style="text-align:right"
use the below code snippet as reference:
----------- Vf page---------------
<apex:page controller="cls_rigthalign" >
<apex:dataTable value="{!con}" var="tt">
<apex:column style="text-align:right" ><apex:facet name="header">Name</apex:facet> {!tt.name}</apex:column>
<apex:column style="text-align:right" ><apex:facet name="header">Email</apex:facet> {!tt.email}</apex:column>
</apex:dataTable>
</apex:page>
------------- Apex Controller ------------
public class cls_rigthalign
{
public list<contact> con{get;set;}
public cls_rigthalign ()
{
con =[select name,email from contact limit 10];
}
}
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
use the div tag to wrap around ur header, it should work.
<div align="right">
</dev>
Hi
Thanks for your reply. Your solution only right aligns the data, not the header :( Any other ideas?
Thanks
Ross
<apex:facet name="header">
<apex:outputPanel layout="block" style="text-align:center">
Email Notifications
</apex:outputPanel>
</apex:facet>