cancel
Showing results for 
Search instead for 
Did you mean: 

Group by not working in Fiori Elements UI for CAP project

former_member66
Advisor
Advisor

Hi,

I am trying to add grouping to the table on my List Report page. I added the following annotations in CDS:

annotate service with @(UI: {
    PresentationVariant : {
        SortOrder      : [{
            $Type    : 'Common.SortOrderType',
            Property : occurredAt,
            Descending : true
        }],
        GroupBy : [
            correlationId
        ],      
        RequestAtLeast : [
            occurredAt, correlationId
        ],
        Visualizations : ['@UI.LineItem']
    },
...

Sorting for the table seems to work as intended, however group by has no effect. I also tried different table types (GridTable, TreeTable, AnalyticalTable) but the grouping does not get applied for any type.

What is the correct way to group data in a table of the List Report page via annotations?

Domae
Participant

Hey Lena,

did you managed to find a solution for this problem? I am having the same issue and I don't have any clue how to implement this.

I found out, that Grouping is currently only supported in OData V2 services. But in our scenario we are using Node.js OData V4 services and consume them with the v2 functionality.

Best Regards

Dominik

former_member66
Advisor
Advisor

Hey Dominik,

while dealing with this I discovered that grouping via annotations was not supported for Fiori Elements V2 at the time (as stated here: https://answers.sap.com/answers/13231481/view.html). Not sure if this has been resolved by now. We chose to use an extension instead to achieve a grouped table.

Best Regards

Lena

max_1234
Explorer
0 Kudos

Hey Lena,

i'm dealing still with the same issues regarding the groupby cds annotation. Can you please give me some advice, how the extension has to be implemented?

Best Regards
Mario

former_member66
Advisor
Advisor

Hi Mario,

As I recall, we used a controller extension to access the 'beforeRebindTable' event and add a 'sap.ui.model.Sorter' for the grouping of the Table there. Not sure, if there's been some progress on this in the meantime.

Regards,

Lena

max_1234
Explorer

Hi Lena,

thank you for the hint. I was able to get the grouping right.
Under the directory webapp/ext/controller i created the file ListReportExt.controller.js:

sap.ui.define([],
function (){
"use strict";
return {
onBeforeRebindTableExtension: function(oEvent){
var oParameters = oEvent.getParameter("bindingParams");
oParameters.sorter = [
new sap.ui.model.Sorter("cetxt", false, true),
];
}
};
});

Regards
Mario

gavin_gu
Participant
0 Kudos

Hi Lena,

We met the same issue.

Could you please share your solution how to make 'groupby' work in Fiori Elements? (CAP projects)

Thanks & regards,

Gavin

Accepted Solutions (0)

Answers (0)