You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Cooper, Stephen" <St...@McKesson.com> on 2007/02/08 23:52:18 UTC

multiple rows of column headers possible?

I would like to have multiple rows of column headers which groups column
headers according to a group.
I'd like the output to look something like:

+-----+---------+---------+
|     | group 1 | group 2 |
|     +----+----+----+----|
| Day | h1 | h2 | h3 | h4 |
===========================
| Mon | 1,1| 1,2| 1,3| 1,4|
|     | 2,1| 2,2| 2,3| 2,4|
| Tues| 3,1| 3,2| 3,3| 3,4|
---------------------------

In other words, Day is the first <th>, it has a rowspan=2.  "group 1"
has a colspan=2, and group 2 also has a colspan=2.

There's an empty <th> in the second <tr>, then <th> cells for h1..h4.

I'm thinking it would be along the lines of the groupBy="true" in the
<t:column> tag, or perhaps combined with a more complex DataModel than
just a ListDataModel wrapping a collection of Strings. 

Since I want to use groupBy="true" for the rows too, I can't just flip
the axis, otherwise that would be an easy solution.

Any and all help is appreciated!

Thanks!
Coop


Re: multiple rows of column headers possible?

Posted by Jeff Bischoff <jb...@klkurz.com>.
Coop,

This was asked before. Maybe the previous solutions could help you?

[1] http://www.nabble.com/Hierarchial-Column-Labels-tf2346303.html#a6535068
[2] 
http://www.nabble.com/multi-column-row-header-with-t%3AdataTable-tf1982130.html#a5439972

Cooper, Stephen wrote:
> I would like to have multiple rows of column headers which groups column
> headers according to a group.
> I'd like the output to look something like:
> 
> +-----+---------+---------+
> |     | group 1 | group 2 |
> |     +----+----+----+----|
> | Day | h1 | h2 | h3 | h4 |
> ===========================
> | Mon | 1,1| 1,2| 1,3| 1,4|
> |     | 2,1| 2,2| 2,3| 2,4|
> | Tues| 3,1| 3,2| 3,3| 3,4|
> ---------------------------
> 
> In other words, Day is the first <th>, it has a rowspan=2.  "group 1"
> has a colspan=2, and group 2 also has a colspan=2.
> 
> There's an empty <th> in the second <tr>, then <th> cells for h1..h4.
> 
> I'm thinking it would be along the lines of the groupBy="true" in the
> <t:column> tag, or perhaps combined with a more complex DataModel than
> just a ListDataModel wrapping a collection of Strings. 
> 
> Since I want to use groupBy="true" for the rows too, I can't just flip
> the axis, otherwise that would be an easy solution.
> 
> Any and all help is appreciated!
> 
> Thanks!
> Coop
> 
> 
> 
>