13
Views
2
Comments
Solved
[OutSystems Data Grid] Data Grid – Grouped Column to be Retained in Grid
outsystems-data-grid
Reactive icon
Forge asset by OutSystems
Application Type
Reactive
Service Studio Version
11.55.14 (Build 64054)

Hello Everyone,

When I apply grouping on a column, the grouped column is completely removed from the grid header section. It only appears inside the group row (e.g., Employee Name: (2 items)), but it is no longer visible as a normal column in the grid. 

Is there a way to retain the grouped column in data grid header while grouping is applied? 

Regards,

Sudharshan

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Sudharshan T,

This is possible by using extensibility, so please check in the future the Wijmo Flexgrid documentation to check if it's possible first.

Currently, you can accomplish this by using the following code in a JSNode in Grid’s block OnInitialize event handler:

// Get grid instance
var theGrid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId);

// Disable hideGroupedColumns option
theGrid.features.groupPanel._groupPanel.hideGroupedColumns = false;

// Force visibility whenever the grouping changes
theGrid.provider.itemsSource.groupDescriptions.collectionChanged.addHandler(function() {
    setTimeout(() => {
        theGrid.provider.columns.forEach(c => c.visible = true);
    }, 0); // Timeout ensures Wijmo's internal 'hide' logic finished first
});

/* 
 $parameters.GridWidgetId being the Grid block identifier
*/

Final result:


Best Regards,
GM

2020-08-05 08-52-58
Ruben Goncalves

Hi Sudharshan,

That's the behavior by design. I think that the easiest way would be to duplicate the column (however non-sense it might sound).

Best regards,

RG

2022-11-12 11-28-30
Gonçalo Martins
Staff
Solution

Hi @Sudharshan T,

This is possible by using extensibility, so please check in the future the Wijmo Flexgrid documentation to check if it's possible first.

Currently, you can accomplish this by using the following code in a JSNode in Grid’s block OnInitialize event handler:

// Get grid instance
var theGrid = OutSystems.GridAPI.GridManager.GetGridById($parameters.GridWidgetId);

// Disable hideGroupedColumns option
theGrid.features.groupPanel._groupPanel.hideGroupedColumns = false;

// Force visibility whenever the grouping changes
theGrid.provider.itemsSource.groupDescriptions.collectionChanged.addHandler(function() {
    setTimeout(() => {
        theGrid.provider.columns.forEach(c => c.visible = true);
    }, 0); // Timeout ensures Wijmo's internal 'hide' logic finished first
});

/* 
 $parameters.GridWidgetId being the Grid block identifier
*/

Final result:


Best Regards,
GM

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.