Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Centering a checkbox in a h:dataTable column

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a data table with some check boxes in it. I would like to have those checkboxes to be centered within their cells and can't get it to work. I've tried text-align: center and columnClasses with no luck. Can checkboxes even be centered? My code is as follows:

<h ataTable value="#{List.newList}" headerClass="tableHeader" var="person">
<h:column>
<f:facet name="header">
<h utputText value="Name"/>
</f:facet>
<h utputText value="#{person.Name}"/>
</h:column>

<h:column>
<f:facet name="header">
<h utputText value="Processed"/>
</f:facet>
<h:selectBooleanCheckbox value="#{person.processed}" style="text-align: center"/>
</h:column>
</h ataTable>
 
Saloon Keeper
Posts: 28108
198
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
I got zapped by that one just the other day.

The answer is "yes", but not by applying styling at the component level.

Use the columnClasses attribute of the dataTable tag, instead.
 
Ian Dunsirn
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did try that and still got nothing. Is there an example somewhere?
 
I love a good mentalist. And so does this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic