You need to sign in to do that
Don't have an account?
Zoom_V
How to center a field appearing in a Visualforce datatable column
I am attempting to center the contents of an outputfield which I am placing into a datatable's column. I can't find an attribute for the datatable which can do this. The closest I can find is an attribute which will center the datatable itself, but I don't want that.
Here is an example of the code :
I would like the outputlabels to be centered within their column as well.
Anybody got an idea on this ?
Thank you.
Here is an example of the code :
<apex:dataTable value="{!Vendor_Product_Review__c}" var="pitem" border="4" align="left" cellpadding="10" rowClasses="rowWithBorder"> <apex:column headerValue="" > <apex:outputLabel >Credit </apex:outputLabel><br></br> <apex:outputLabel >Liquidity </apex:outputLabel><br></br> <apex:outputLabel >Transaction </apex:outputLabel><br></br> <apex:outputLabel >Foreign Exchange </apex:outputLabel><br></br> <apex:outputLabel >Interest Rate </apex:outputLabel><br></br> <apex:outputLabel >Reputation </apex:outputLabel><br></br> <apex:outputLabel >Operational </apex:outputLabel><br></br> <apex:outputLabel >Price </apex:outputLabel><br></br> <apex:outputLabel >Compliance </apex:outputLabel><br></br> <apex:outputLabel >Strategic </apex:outputLabel><br></br> <apex:outputLabel >Financial </apex:outputLabel><br></br> <apex:outputLabel >Other </apex:outputLabel><br></br> </apex:column> <apex:column headerValue="Probability" > <apex:outputfield value="{!pitem.CreditRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.LiquidityRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.TransactionRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.ForeignExchangeRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.InterestRateRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.ReputationRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.OperationalRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.PriceRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.ComplianceRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.StrategicRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.FinancialRiskProbability__c}"/><br></br> <apex:outputfield value="{!pitem.OtherRiskProbability__c}"/><br></br> </apex:column>
I would like the outputlabels to be centered within their column as well.
Anybody got an idea on this ?
Thank you.
Have you tried wrapping it around <div></div> tags. with the center attribute? (
<div align="center"> )
from memory I had issues with this and datatables in the past.
If that doesn't work try adding a styleclass or style (i forget which one it is for apex:collumns ) with the font-align: center; attribute.
I hope you find the answer.
Mikie