cancel
Showing results for 
Search instead for 
Did you mean: 

Table Grouping in Fiori Elements

rogerio_ribeiro2
Explorer
0 Kudos
183

Hi experts,

I'm developing an application using fiori elements, with a template list page and object page.

I would like to group the table in the object page by Storage Location. It would be a regular grouping, without aggregation. I've tried using CDS annotations and XML annotations, without success.

In the annotation target, I've tried with the entity itself and also its container.

<Annotations Target="SAP__self.Container/zz_pv_stock_zite_assets">
                <Annotation Term="UI.PresentationVariant">
                    <Record Type="UI.PresentationVariantType">
                        <PropertyValue Property="GroupBy">
                            <Collection>
                                <PropertyPath>StorageLocation</PropertyPath>
                            </Collection>
                        </PropertyValue>
                        <PropertyValue Property="Visualizations">
                            <Collection>
                                <AnnotationPath>@UI.LineItem</AnnotationPath>
                            </Collection>
                        </PropertyValue>
                    </Record>
                </Annotation>
            </Annotations>

            <Annotations Target="SAP__self.zz_pv_stock_zite_assetsType">
                <Annotation Term="UI.PresentationVariant">
                    <Record Type="UI.PresentationVariantType">
                        <PropertyValue Property="GroupBy">
                            <Collection>
                                <PropertyPath>StorageLocation</PropertyPath>
                            </Collection>
                        </PropertyValue>
                        <PropertyValue Property="Visualizations">
                            <Collection>
                                <AnnotationPath>@UI.LineItem</AnnotationPath>
                            </Collection>
                        </PropertyValue>
                    </Record>
                </Annotation>
            </Annotations>

It doesn't work, however the grouping works when I do directly in the app using the engine icon.

What could be missing?

Thank you in advance, Rogerio

View Entire Topic
Senqi_Hu
Participant

https://sapui5.hana.ondemand.com/resources/sap/suite/ui/generic/template/js/AnnotationHelper-dbg.js 

I see that AnnotationHelper.js doesn't handle the annotation @ui.presentationVariant.groupBy, but does handle the annotation @ui.presentationVariant.sortOrder. This causes the annotation @ui.presentationVariant.sortOrder can work normally, and the annotation @ui.presentationVariant.groupBy  doesn't work. That's what I suspected.

But you can try it with front-end extension,  Put the following code into the ObjectPageExt.controller.js.

onBeforeRebindTableExtension: function(oRebindObject) {
    oRebindObject.getParameter("bindingParams").sorter.push(new sap.ui.model.Sorter("StorageLocation", true, true));
}

 group.jpg

 

rogerio_ribeiro2
Explorer
0 Kudos
Hi, thank you for your suggestion. Please, let me know if ObjectPageExt.controller.js you mentioned, could be the custom section controller? I've included the same method in this corresponding custom section controller, but it's not sensible to the process when I load the application. Regards, Rogerio