The short answer is you cannot.
The Table component is driven by a data model (Container) and is designed to display row-oriented data.
However, you can usually achieve the desired effect by using a GridLayout instead of a Table component. GridLayout permits you to specify a rectangular area of the grid for your component, and is often better suited for visually more complex layouts, where a part of or all of the structure is typically static. GridLayout can be used e.g. for reports with column spanning headers.
For very large tables containing a large number of components, GridLayout performance may not be very good. In these cases, you could also take a look at FastGrid in the incubator project FastLayouts, which implements most of the API of GridLayout. See
http://vaadin.com/forum/-/message_boards/message/18879 for more information.
Oh man Data model driven approach suits very well on my usecase, I would just need to group rows every now and then by doing row with spanned columns with simple text inside.
I guess I’ll take a look GridLayout but otherwise Table is just perfect for my needs (columns and row selections etc).
I would think this kind of colspan feature would be usefeull for others as well?
One further question: is it possible to add checkbox to header row, it would be used for “select all” kind of functionality.
thanks Joonas for reply. Ticket 3153 seems just the same as feature I asked, possibility to add optional “header” rows, but not just below real header, they should be allowed anywhere on table, for example summary row for calculated total amounts. Ticket 3152 refers to expandable detail row, that would also to the trick, could be just too “heavy” for general purpose colspannable row.
I’ll open new ticket for select all functionality!
For the header checkbox (or handling click events from the header), there is a related request already - see
http://dev.vaadin.com/ticket/2825 . Maybe a comment in this one would be sufficient?
The correct way to handle this would probably be to support arbitrary components in the table header.
Henri you are right, that’s exactly right feature, and yes, checkbox is just one example header could support, other arbitrary components would be nice as well.
Btw, I cant register to Trac, when I post register form, server asks authentication, or maybe I’m missing something here ?
That would be a footer, right? There’s a ticket about it:
http://dev.vaadin.com/ticket/3045 . I known at least one project which would gladly use that feature
It seems that something has broken the registration system. I’ll ask our Trac guru to take a look of it asap and email you a new trac account immediately.