javascriptsapui5sap-fiori

Fiori Elements / List Report --> use extensionAPI to get selected Table Value when it's hidden


i am trying to implement a logic to change a button text in a fiori elements list report based on a hidden column value of a selected row in a table.

Note: I have to use the extensionAPI, since it's a simple Elements List Report.

I am able to get the value when the column is not hidden using this solution:

let aContexts = this.extensionAPI.getSelectedContexts();
aContexts.forEach(element => {
    let data = element.getModel().getObject(element.getPath());
    console.log('Selected Rows are => ', data);
});

I also know how to change the button text:

oEvent.getSource().setProperty("text","Text");

What I don't know is how to get the value if the column in the table is hidden. It seems that this.extensionAPI.getSelectedContexts(); just delivers visible columns.


Solution

  • I finally found a solution to always get specific columns by adding the following annotation directly in the CDS View

    @UI.presentationVariant: [{requestAtLeast: [ '{{hiddenValue}}' ]}]