4

I was using setColumnHeader(Object, String) to set a simple string as a column header. I want to create a complex header. I would like to know if there is any way to build a similar table as shown in the below figure in Vaadin 7. https://i.stack.imgur.com/u5dIw.gif

Java Kumara
  • 97
  • 2
  • 12

2 Answers2

3

Not at the moment.

It is scheduled for vaadin 7.4, which is currently in alpha stage.

André Schild
  • 4,592
  • 5
  • 28
  • 42
  • Thank you Andre Schild. If there is not any straight forward way, is there any hack which can be done? – Java Kumara Nov 03 '14 at 11:44
  • One way would be to remove the header from the table altogether and create the header from separate vaadin components. But in this case you'll have to explicitly set the column widths or expand ratios, because otherwise you won't be able to access those on server side. – kris54321 Nov 06 '14 at 14:16
  • The [FilteringTable](https://vaadin.com/directory#addon/filteringtable:vaadin) addon does something in the header area, perhaps you can sneak at the code? http://tepi.virtuallypreinstalled.com/filteringtable-v7/?restartApplication and – André Schild Nov 06 '14 at 17:50
  • This answer refers to an entirely new table widget being designed and built by the Vaadin team. Probably to be called *Grid*. To quote [their blog](https://vaadin.com/blog/-/blogs/7-series): `Simply put, we want Grid to be the best data grid for web. Par none. This sets the bar really high for performance, scalability, features and customizability.` – Basil Bourque Nov 20 '14 at 16:49
3

Now it is possible using Grid:

enter image description here

// Group headers by joining the cells
HeaderRow groupingHeader = grid.prependHeaderRow();
HeaderCell namesCell = groupingHeader.join(
    groupingHeader.getCell("firstname"),
    groupingHeader.getCell("lastname"));
HeaderCell yearsCell = groupingHeader.join(
    groupingHeader.getCell("born"),
    groupingHeader.getCell("died"),
    groupingHeader.getCell("lived"));

This example is taken from Vaadin Book. Just to show that new Vaadin 7.5 (and above) can build table with complex header (joined columns). Another good resource is in Vaadin Wiki.

As you notice such grouping is also possible for footer row.

jsosnowski
  • 1,560
  • 3
  • 26
  • 56
  • I did search for a possibility to do grouping with rows. I didn't find anything. Is it possible anyway? What about a combination of column and row grouping? – oopexpert May 04 '17 at 14:42