File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes how to align the content of the column values in datatable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "how to align the content of the column values in datatable?" Watch "how to align the content of the column values in datatable?" New topic
Author

how to align the content of the column values in datatable?

Ilayaraja Raju
Greenhorn

Joined: May 11, 2008
Posts: 10
Hi I have a small issue:

I have the below code to render a html table with the column header (Document Code) and the column values using hutputText .

<h:dataTable value="#{docCodeSearch.results}" var="c" styleClass="order-table" headerClass="order-table-header" rowClasses="order-table-odd-row,order-table-even-row">
<h:column>
<f:facet name="header">
Document Code
</f:facet>
<hutputText value="#{c.docCode}"/>
</h:column>
</h:dataTable>.

How can i make the column values (<hutputText> values) to be left aligned or right aligned?
Neither <hutputText> nor <h:column> does not accept align property.

Can you please help..


Regards,<br />Ilaya
Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Try this


Or you can use the columnClasses attribute of the dataTable and set the css classes.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16305
    
  21

Welcome to the JavaRanch, Ilayaraja!

You can adjust the widths and alignments of columns in a dataTable using the "columnClasses" attribute. The columnClass and rowClass will be combined along with any other applicable CSS class/style info for the column element.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ilayaraja Raju
Greenhorn

Joined: May 11, 2008
Posts: 10
Sridhar Santhanakrishnan wrote:Try this


Or you can use the columnClasses attribute of the dataTable and set the css classes.


Hi Sridhar,

I tried adding <f:attribute>, but not helpful. doesnt work.

I want to align only particular column. In that case, can I go for columnClasses attribute in the <h:dataTable>?

Thanks.
Ilaya
Ilayaraja Raju
Greenhorn

Joined: May 11, 2008
Posts: 10
Hi,

Thanks Guys.

I am able to set the width and align left using columnClasses attributes and css as

columnClasses="order-table-docno-column,order-table-column,order-table-desc-column,order-table-desc-column,order-table-column,order-table-column,order-table-column">

Thanks a lot.

Regards,
Ilaya

Ilayaraja Raju wrote:
Sridhar Santhanakrishnan wrote:Try this


Or you can use the columnClasses attribute of the dataTable and set the css classes.


Hi Sridhar,

I tried adding <f:attribute>, but not helpful. doesnt work.

I want to align only particular column. In that case, can I go for columnClasses attribute in the <h:dataTable>?

Thanks.
Ilaya
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to align the content of the column values in datatable?