cancel
Showing results for 
Search instead for 
Did you mean: 

How to Pre-Filter data in table using Fiori Elements ?

01-09-2025 11:43 PM
David21 Explorer
1631 views 3 comments
0 Likes
SAP Managed Tags
Labels
CAPFilterFiori ElementsNode.js
Subscribe

Hello everyone,

I'm using CAP(Node.js) with odata(v4) & fiori elements. My requirement is to pre-filter the data being displayed in the table (UI.LineItem). What i mean by pre-filter is that when user sees the table he doesn't have to select a value from selection fillter and press go, the data is already filtered on some fixed condition when the page is rendered. I read a blog that shows how to filter data based on segmented buttons using SelectionVariant annotaion but haven't found anything without clicking the buttons.

Blog link : https://community.sap.com/t5/technology-blogs-by-sap/cap-with-fiori-elements-configure-multiple-view....

I also tried the FilterExpression annotation i.e.

 SelectionVariant : {
        $Type        : 'UI.SelectionVariantType',
       FilterExpression : 'field eq val'
         }

but that didn't seem to do anything. Also i can't use javascript to filter data because i have created multiple tables(LineItem) on a single entity, and JS will affect the data in all of these tables. Therefore i'm trying to find a solution based on annotations.

Any Ideas how to achieve this ?

0 Likes

Accepted Solutions (0)

Answers (1)

Answers (1)

Dinu
Active Contributor
0 Likes

Please look at the sample provided in the blog. I wonder if this can be explained better than in the blog. Here is are two clues: The first view is automatically selected. You may provide only one view. 

David21
Explorer
0 Likes
I did try only providing one view but it didn't seem to have any affect. Maybe because i'm trying to display the table on object page. Someone else was facing a similar issue : https://community.sap.com/t5/technology-q-a/filter-items-in-a-object-page-table-with-fiori-elements-...
Dinu
Active Contributor
0 Likes

Support for SelectionPresentationVariant in Object Page was added in version 121 (mentioned in change log and documentation #Rendering a Table in a Section). So, If you use any later version, it should work.