Blank labels in Datagrid with aggregation on top and filter columns

Hi JMIX Team,

Version: 2.2.3.

We are using filtering in columns and aggregation (SUM), there is a problem because the label name is not displayed when you have add filterable=“true” in any column and you add aggregation type=“SUM” in any othe column, all labels are set to blank. Is there any workaround to solve it?

image

Hi!

I have investigated the problem. This happens because the Vaadin Framework group cells and moves content when appending a new header row.

Here is the created issue for this problem.: Header text can't be displayed in a column with a header filter and top aggregation · Issue #3384 · jmix-framework/jmix · GitHub
The fix is planned for the upcoming 2.3 release.

To fix this right now, you can set the aggregatable property for the DataGrid programmatically in the controller (for example, at the InitEvent):


    @ViewComponent
    protected DataGrid<YourEntity> yourDataGrid;

    @Subscribe
    public void onInit(InitEvent event) {
        yourDataGrid.setAggregatable(true);
    }

Please note that the aggregationPosition property is specified using XML markup, but the aggregatable is set using Java code in the controller, since it is the aggregatable property triggers the initialization logic for the new header row.


        <dataGrid id="yourDataGrid"
                  width="100%"
                  columnReorderingAllowed="true"
                  minHeight="20em"
                  dataContainer="yourDc"
                  aggregationPosition="TOP">
        <!-- dataGrid content -->
    </dataGrid>

This way, header filters will have time to initialize, and adding a header row will not break the displaying.

Best regards,
Dmitriy

Thank you for the fast reply