on ‎2025 Feb 07 11:06 AM
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
Request clarification before answering.
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));
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you, this worked for me. Is it possible to display the associated text on the group headers, instead of the id (but still group by the id) ?
And how to require the grouped field values to always be loaded even if it is not part of the displayed columns ? Otherwise the values of the groups are blank.
| User | Count |
|---|---|
| 11 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.