File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Ilayaraja Raju
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this


Or you can use the columnClasses attribute of the dataTable and set the css classes.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17622
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ilayaraja Raju
Greenhorn
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic