Custom header using CompositeCell or AbstractCell

177 views
Skip to first unread message

kretel

unread,
Mar 13, 2012, 6:31:59 AM3/13/12
to google-we...@googlegroups.com
Hi,

I am trying to build a custom header which have two labels in a header and both are styled differently. For example: 

| header1 - label1 | header2 - label1 |
+-----------------------+------------------------+
| header1 - label2 | header2 - label2 |

Label1 in headers needs to be styled differently than label2. Further label2 needs to be able to trigger column sort on a table. 

I was looking at examples how to build AbstractCells but still can't see how this can be applied to header. 

Does anyone come up with an approach to build Custom header? 

Thanks,
Kris



kretel

unread,
Mar 13, 2012, 8:38:05 AM3/13/12
to google-we...@googlegroups.com
What I might actually need is to get two rows inserted into theader in CellTable. 
So the header look like this: 

|          | header1 - label1 | header2 - label1 |
+----------+------------------+------------------+
| label    | header1 - label2 | header2 - label2 |
+----------+------------------+------------------+
| foobar   |  1               | image            |

Is there a way to add an extra header row to a CellTable after adding a column with one header? 

Thanks,
Kris

Ümit Seren

unread,
Mar 13, 2012, 11:37:46 AM3/13/12
to google-we...@googlegroups.com

kretel

unread,
Mar 13, 2012, 11:50:01 AM3/13/12
to google-we...@googlegroups.com
Thanks for the pointer. I saw it and follow similar pattern, but it does not give you flexible approach to styling differently both rows in the header. 

you also wrote: "[...]  Well I ended up solving this by adding separate SearchBoxes above the CellTable-Header and using CSS to align them to the Header.  [...]" which I am trying to avoid. 
Imagine you provide different language for your app and table headers width/height will change. So css might not work in this case. 

Thanks,
Kris

Ümit Seren

unread,
Mar 13, 2012, 11:55:16 AM3/13/12
to google-we...@googlegroups.com
I believe that from GWT 2.4 on there a Builder class for making more
advances and sophisticated Headers/Footers. But I haven't tried it
myself.
But I am not sure why it won't give you flexible approach for styling?
You can add a class to the row/cell in the render method of your
Header class.
I agree that my approach is a hack (but there was no easy way to solve
it back then).

> --
> You received this message because you are subscribed to the Google Groups
> "Google Web Toolkit" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-web-toolkit/-/PToCkdTcDqgJ.
> To post to this group, send email to google-we...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-web-tool...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.

Andrea Boscolo

unread,
Mar 13, 2012, 3:06:14 PM3/13/12
to google-we...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages