• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 h:outputText .

<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>
<h:outputText value="#{c.docCode}"/>
</h:column>
</h:dataTable>.

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

Can you please help..
 
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this


Or you can use the columnClasses attribute of the dataTable and set the css classes.
 
Saloon Keeper
Posts: 25645
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic