cancel
Showing results for 
Search instead for 
Did you mean: 

Expand and Collapse at Group Level for sap.m.Table

SKBoss
Discoverer
0 Kudos

Hello Experts,

Is there any we can collapse / expand data on the sap.m.Table at the Group level? We are expecting large data and we wanted to see if we can collapse data by default to the user. 

In other way we are trying to Group the data and utilize Tree table expand / collapse feature. 

Thanks,

Sridhar 

Accepted Solutions (0)

Answers (1)

Answers (1)

sajid-khan
Explorer
0 Kudos

sap.m.Table is not intented to display large amounts of data. As a matter of fact, by default sap.m.Table displays only 100 items if growing property with a large growingThreashold is not set.

If you have control over your backend OData service, consider using sap.ui.Table.AnalyticalTable as it has collapse/expand feature on groups. In order to use AnalyticalTable, your OData should be properly annotated. See Table Groupings for more information. 

If you want to stick to sap.m.Table, you can implement a custom group header using groupHeaderFactory property of items binding of the table. Here's how you might want to do it:

  • Bind the visibility of items template (ColumnListItem) to the group key using JSONModel.
  • Include a toggle button inside the custom group header. When the toggle button is pressed, the visibility (bound to group key) of the items of that group can be toggled.
This will work however please keep in mind that this approach might deviate from Ui5's standard design patterns, potentially impacting user experience. Plus, as I've mentioned, sap.m.Table is not designed to display huge amount of data, you would still face performance lags with huge number of rows (even if those are collapsed) when interacting with the table.
 
Regards
Sajid Khan