108
Views
3
Comments
Solved
[OutSystems Data Grid] Collapse all groups
outsystems-data-grid
Reactive icon
Forge asset by OutSystems

I would want to make all the groups collapsed on default. Is there a solution for this?


My version of data grid is 2.9.0

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

Hello @Juween 

You need to pass the index on the collapseGroupsToLevel method:

const grid = OutSystems.GridAPI.GridManager.GetActiveGrid($parameters.GridWidgetId);
grid._provider.collapseGroupsToLevel(0);

Check the example attached where this is the end result:


If you want to have this everytime you drag a column into the panel you need to add an event listener to call the same method to collapse it.

Cheers,
GM



DataGrid_CollapseAllGroup_Fix.oml
2021-03-18 21-03-15
Benjith Sam
 
MVP

Hi Juween,

If my understanding of your use case is correct, I attempted to create a sample implementation, and I noticed that the groups are collapsed by default. However, you can try executing the following JavaScript code in the Grid OnInitialize event handler to explicitly collapse the groups. 

JS Snippet:

const grid = OutSystems.GridAPI.GridManager.GetActiveGrid($parameters.GridWidgetId);
grid._provider.collapseGroupsToLevel();

I hope this helps you!


Kind regards,

Benjith Sam

2022-12-05 02-29-23
Zureen Camelia Zulkapli

Hi Benjith,


Thank you for your response.

Tried your solution and it is still not working for me. 

I have attached my oml, would really appreciate if you could help checking my application


Thank you,

Zureen.

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

Hello @Juween 

You need to pass the index on the collapseGroupsToLevel method:

const grid = OutSystems.GridAPI.GridManager.GetActiveGrid($parameters.GridWidgetId);
grid._provider.collapseGroupsToLevel(0);

Check the example attached where this is the end result:


If you want to have this everytime you drag a column into the panel you need to add an event listener to call the same method to collapse it.

Cheers,
GM



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