• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

dataTable styling question

 
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Does anyone know how to make a panelGrid's main header row different from the cell's header rows? For example, if you look at the screen shot

http://screencast.com/t/T7sN6r3B

I want the "Results 1-20" row to have a different class than the row with the column titles ("Client System", "Destination System", etc.). Here's the (unsuccessful) JSF I'm using ...

<h:dataTable id="dt1" binding="#{SearchResultsPage.dataTable}" value="#{SearchBean.results}" var="item" border="10" cellpadding="5" cellspacing="3" dir="LTR" frame="hsides" rules="all" columnClasses="tableHeader" rowClasses="evenRow,oddRow" headerClass="tableHeader2">
<f:facet name="header">
<h:outputText value="Results #{SearchBean.startResultRow}-#{SearchBean.lastResultRow} of #{SearchBean.numResults} (#{SearchBean.numPages} page(s))" />
</f:facet>
<h:column>
<f:facet name="header">
<h:outputText value="Client System" />
</f:facet>
<h:outputText value="#{item.clientSys}"></h:outputText>
</h:column>



"f:facet" doesn't support styleClass, so I pose this question to the group for inspiration. Thanks, - Dave
 
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Dave,

facet might not support styleClass, but doesn't outputText support styleClass??

cheers
Darryl
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is applying a styleClass to the outputText only applies it to the span and not the overall TD. This is what happens

http://screencast.com/t/jl3oCGS3

when I do this ...

<h:dataTable id="dt1" binding="#{SearchResultsPage.dataTable}" value="#{SearchBean.results}" var="item" border="10" cellpadding="5" cellspacing="3" dir="LTR" frame="hsides" rules="all" rowClasses="evenRow,oddRow" headerClass="tableHeader2">
<f:facet name="header">
<h:outputText value="Results #{SearchBean.startResultRow}-#{SearchBean.lastResultRow} of #{SearchBean.numResults} (#{SearchBean.numPages} page(s))" />
</f:facet>
<h:column>
<f:facet name="header">
<h:outputText styleClass="tableHeader" value="Client System" />
</f:facet>
<h:outputText value="#{item.clientSys}"></h:outputText>
</h:column>

There's got to be a way to make the style apply to the table cell. How?

Thanks, - Dave
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I implemented a simple datatable to do what you were aiming for.
Here is the code:


mystyle.css


Hope it works for you
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your response but when I added the "headerClass" attribute to the h:column tag, I got this compilation error

search_results.jsp:46:15: This attribute is not recognized.
<h:column headerClass="tableHeader">
^---------^

I'm using WebLogic 9.2.2 with MyFaces 1.1.5.

- Dave
 
Kavita Tipnis
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I checked the differences in both Mojarra (Sun JSF RI ) and MyFaces RI and you are right, there is no attribute 'headerClass' in MyFaces RI
(Links to check:
http://java.sun.com/javaee/javaserverfaces/1.2_MR1/docs/tlddocs/index.html
http://myfaces.apache.org/core11/myfaces-impl/tlddoc/index.html
)
However, I think in MyFaces you can create an tablecolumn component(programmatically) or use binding attribute and use the setHeaderClass()method on the column. I am not using MyFaces RI, if you check the API docs you will get more information.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic