Adding a summary header for columns and rows [message #1807718] |
Thu, 06 June 2019 11:49  |
Eclipse User |
|
|
|
I would like to add a single header for a group of columns and rows.
I've tried using `ColumnGroupHeaderLayer` but the text is in the centre of the column. Instead I would like it to always have the text drawn in the centre of the visible cell and always remain in the same position as I scroll.
I've looked through a lot of documentation but I'm struggling to find anything on how I could do this.
I've attached an example of what I'm aiming for.
Is it possible to achieve this with NatTable?
|
|
|
|
|
|
Re: Adding a summary header for columns and rows [message #1807758 is a reply to message #1807750] |
Fri, 07 June 2019 10:51   |
Eclipse User |
|
|
|
I've managed to get a composite layer to work correctly for the columns header but I can't get it to work for the row headers.
/**
*
* Column Header composite
*
*/
final CompositeLayer compositeColumnHeaderLayer = new CompositeLayer(1, 2);
final GroupByHeaderLayer groupByColumnHeaderLayer = new GroupByHeaderLayer(new GroupByModel(), columnLayer,
columnData);
compositeColumnHeaderLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByColumnHeaderLayer, 0, 0);
compositeColumnHeaderLayer.setChildLayer("Grid", columnLayer, 0, 1);
/**
*
*
* Row Header composite
*
*/
final CompositeLayer compositeRowHeaderLayer = new CompositeLayer(2, 1);
final GroupByHeaderLayer groupByRowHeaderLayer = new GroupByHeaderLayer(new GroupByModel(), rowLayer, rowData);
compositeRowHeaderLayer.setChildLayer(GroupByHeaderLayer.GROUP_BY_REGION, groupByRowHeaderLayer, 0, 0);
compositeRowHeaderLayer.setChildLayer("Grid", rowLayer, 1, 0);
/**
*
*
* Grid Creation
*
*/
final CornerLayer cornerLayer = new CornerLayer(cornerDataLayer, compositeRowHeaderLayer,
compositeColumnHeaderLayer);
final GridLayer gridlayer = new GridLayer(bodyLayer, compositeColumnHeaderLayer, compositeRowHeaderLayer,
cornerLayer);
This successfully adds a row above the column headers but the row headers end up displaying incorrectly.
It looks as though I'm creating the row header composite layer the same as the column header composite. Do you know what might be causing it?
|
|
|
|
Powered by
FUDForum. Page generated in 0.04080 seconds