/ Published in: Java
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.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<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>
URL: http://www.codedrop.ca/blog/archives/46