This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSF and the fly likes h:panelGrid and colspan Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "h:panelGrid and colspan" Watch "h:panelGrid and colspan" New topic
Author

h:panelGrid and colspan

Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
is it possible to set colspan using the h:panelGrid? As an example, say I wanted first two rows to be 2X2 and the last one 1X3.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15947
    
  19

No, and it's a real pain. There are some third-party tags that support spanned columns, but not the core tags.

What I end up doing is multiple panelGrids. But then you need to use columnClasses (or equivalent) to keep them lined up properly, since otherwise the column widths will vary for each panelGrid.


Customer surveys are for companies who didn't pay proper attention to begin with.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You can also just use plain vanilla HTML.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15947
    
  19

The downside to embedding raw HTML in JSF is that JSF views are designed to be abstract. The JSF tags support alternative renderers so that, for example, if you want the same data to display on a desktop web browser, a cellphone web browser, WAP, and something exotic like Display PostScript, the same view definition serves all of them and the framework simply selects the renderer appropriate for the client.

HTML tags aren't that smart, so they'll get passed through as though they were ordinary text, which can be ugly (who wants to see raw HTML in their output?)
<p/>
and won't intelligently
arrange the output. based
on the target platform.

While core JSF doesn't support colspan, the Tomahawk panelGroup does, as does the RichFaces column tag. Just don't try and mix and match them. Although the docs don't say so, they expect to be working within the context of their respective table tags.
 
wood burning stoves
 
subject: h:panelGrid and colspan
 
Similar Threads
displaying data in panelgrid
radio button not working properly, list is sorted for every two clicks
How to totally collaspe an unused cell
How to display text & image in richfaces tab
JSF rendering the whole page : Even the basic html tags