Return to Snippet

Revision: 29121
at July 22, 2010 06:53 by adriamooney


Initial Code
<h:panelGrid width=”100%” id=”memberTransactionTableBody” border=”0″ cellspacing=”0″ cellpadding=”0″ columns=”1″>
<h:column>
<h:form id=”form”>

<h:dataTable rowClasses=”accountTransactionRowDefault, accountTransactionRowAlternate”
headerClass=”accountColumnHeader StrongText”
footerClass=”accountColumnFooter”
width=”100%”
cellpadding=”0″ cellspacing=”0″ border=”0″ columnClasses=”account-padding,account-date,account-description,account-debit,

account-credit,account-currency,account-status”
styleClass=”accountTransactionText”
var=”transaction”
value=”#{transactionHandler.transactionBean.transactionHistory}”
rows=”40″>

<h:column> </h:column>

<h:column>
<f:facet name=”header”>
<div style=”float: left;”>
#{messages['message.account.column.date']}
</div>
</f:facet>
<h:outputText value=”#{transaction.dateTimeStamp}”/>
<f:facet name=”footer”> </f:facet>
</h:column>

<h:column>
<f:facet name=”header”>
<div style=”float: left;”>
#{messages['message.account.column.description']}
</div>
</f:facet>
<h:outputText value=”#{transaction.description}”/>
</h:column>

<h:column>
<f:facet name=”header”>
#{messages['message.account.column.debit']}
</f:facet>
<h:outputText value=”#{transaction.debit}”/>
</h:column>

<h:column>
<f:facet name=”header”>
#{messages['message.account.column.credit']}
</f:facet>
<h:outputText value=”#{transaction.credit}”/>
</h:column>

<h:column>
<f:facet name=”header”>
#{messages['message.account.column.currency']}
</f:facet>
<h:outputText value=”#{transaction.currency}”/>
</h:column>

</h:dataTable>

</h:form>
</h:column>
</h:panelGrid>

Initial URL
http://www.codedrop.ca/blog/archives/46

Initial Description
Something I have always found annoying about JSF datatables is the limitation to only apply one header class style to the entire table. This is un-functional for datatables that would display monetary amount or other data that is typically right aligned whereas descriptive columns are left aligned. The table doesn’t look very nice if the heading don’t match the columns.

Initial Title
Changing Header Class (CSS) in JSF Datatables - Codedropâ„¢ Weblog

Initial Tags
class, header

Initial Language
Java