cancel
Showing results for 
Search instead for 
Did you mean: 

how to add a custom action button to a Fiori Element app which displays row data for 1909?

Peter_M
Explorer
0 Kudos

There are many examples which show how to extend a Fiori Element "list" app with a custom "requires selection" button, where the behaviour of this new button is as follows:

  • It only becomes visible when a row is selected
  • When the button is pressed, it shows static text like "hello world" in a message toast.

That is fine, but what if you want adapt the controller code to access a field in the row data of the list. Does anyone know how to achieve this within an extension to a FE app for 1909?

There seems to be nothing on-line that details how to do this in VsCode !! (for a fiori element app that has been developed in VsCode, but has not yet been deployed)

Here is some example coding in 2 files that show how to extend a Fiori Elements "list" app to show static text

In controler extension

sap.ui.define([
    "sap/m/MessageToast"
], function(MessageToast) {
    'use strict';

    return {
        showData: function(oEvent) {
            MessageToast.show("Hello World");
	    }
    };
});<br>

In manifest.json

         "extends": {
            "extensions": {
                "sap.ui.controllerExtensions": {
                    "sap.suite.ui.generic.template.ListReport.view.ListReport": {
                        "controllerName": "zdms.ext.controller.ListReportExt",
                        "sap.ui.generic.app": {
                            "Z_DMSMETA": {
                                "EntitySet": "Z_DMSMETA",
                                "Actions": {
                                    "showData": {
                                        "id": "showDataButton",
                                        "text": "Show Data",
                                        "press": "showData",
                                        "requiresSelection": true
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
View Entire Topic
Peter_M
Explorer
0 Kudos

OK - resolved it with extensionAPI.getSelectedContexts