cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

CDS presentationVariant - maxItems

former_member435529
Participant
3,639

Hi,

I added this to the RAP metadata extension and maxItems is not working regardless of the value. SortOrder works ok though.

Why's that?

Thanks,

Javier

presentationVariant: [{

sortOrder: [{ by: 'TorId', direction: #ASC }],

maxItems: 5,

visualizations : [{ type: #AS_LINEITEM }]

}] }

Accepted Solutions (0)

Answers (2)

Answers (2)

snap_vita
Explorer

Hi,

try to encapsulate your presenationVariant additionally in a selectionPresentationVariant, like this:

presentationVariant: [{

qualifier: 'pVariant'

sortOrder: [{ by: 'TorId', direction: #ASC }],

maxItems: 5,

visualizations : [{ type: #AS_LINEITEM }]

}]

selectionPresentationVariant: [{

presentationVariantQualifier: 'pVariant'

}]

Additionally, if you defined the presentationVariant in a Child Entity, you need to use the type #SELECTIONPRESENTATIONVARIANT_REFERENCE (and not #LINEITEM_REFERENCE) in the parent facet

 

@UI.facet:

[{

...

id: 'Child',

type: #SELECTIONPRESENTATIONVARIANT_REFERENCE,

// type: #LINEITEM_REFERENCE,

position: 20,

targetElement: '_Child'

}]


Regards

PhilippeDaucourt
Participant

Hi,

Maybe a bit late but I faced the same problem in a Fiori Elements List Report (OData v2, UI5 1.108) with a UI.SelectionPresentationVariant annotation.

UI.PresentationVariant.MaxItems is not taken into account because it is not supported as it is mentioned in the source code .

PhilippeDaucourt_0-1731231750945.png

My solution to increase the number of items was to edit the "Growing Thresold" property of the table on the UI side (below are screenshots from SAP Business Application Studio Page Map and Page Editor).

PhilippeDaucourt_2-1731232230978.png

PhilippeDaucourt_1-1731232051333.png

Best regards.

 

Atmananda
Explorer
0 Kudos

@snap_vita Thanks for the code, helped with a Sorting Issue in Child Entity in V4.

Edna_B
Explorer
0 Kudos

Hi,
this is the minimal solution, that worked for me:

You create a presentation variant in the child view and define a qualifier.

@Metadata.layer: #CUSTOMER
@UI.presentationVariant:
    [{
        qualifier: 'DefaultPVariant',
        groupBy: [ 'MaterialClassText' ],
        maxItems: 3,
        visualizations: [{type: #AS_LINEITEM}]
    }]

annotate entity ZC_Child with
{ ...

Then you set the facet type to #PRESENTATIONVARIANT_REFERENCE and the qualifier of the presentation variant as targetQualifier.

annotate view ZC_Parent with
{
  @ui.facet: [{
        targetElement: '_Child',
        type: #PRESENTATIONVARIANT_REFERENCE,
        targetQualifier: 'DefaultPVariant' // presentation variant qualifier
    }]
   ....