• 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

Centering a column heading in a datatable

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is going to sound like a real newbie type question...

How do you center a column heading in a datatable. What I need to do is center the column heading but have the data be right aligned. I can't get the heading to act one way (center) and the column to act another (right aligned).

Any suggestions?
 
Saloon Keeper
Posts: 25640
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
CSS
 
E Paisley
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the suggestion, although I am already doing that... The entire column only responds to the style in the header and not in the data values

[ October 01, 2008: Message edited by: Eric Paisley ]
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this if using verbatim is OK for you.



If it does not works out in this way try putting the whole column in div.
Hope this works.
[ October 01, 2008: Message edited by: Himanshu Gupta ]
 
Tim Holloway
Saloon Keeper
Posts: 25640
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
Actually, it's usually enough to define a table headerClass attribute with centering, then define the columnClass for that column with right, left, or center alignment depending on what looks best for that column.

I do that all the time, such as when displaying columns with currency values (right-aligned) and text values (left-aligned), often centering items like dates and Y/N value columns.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic