cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle Edit button from Object Page ( Developed using Fiori Elements and BOPF )

Nadeem_Mohammed
Explorer
0 Kudos

In case we created a CDS view, generated a Business Object (BOPF) for it, exposed via OData using annotations and created Fiori Element List Report application based on this service.

In the Object Page for EDIT button :

  1. How can we handle dynamic behavior based on the content for EDIT button ? For instance, we want to disable the Edit option that users can edit content based on the Order Status.
  2. How can we remove EDIT button from object page (in case this is not required) ?

Accepted Solutions (0)

Answers (2)

Answers (2)

luizems
Explorer

Hi Nadeem,

I supposed that you can disable on BOPF and automaticly It will be invisible, but also you can do this in your IDE.

Extend a Controller to ObjectPage and in onInit, set this code:

"sap/suite/ui/generic/template/extensionAPI/extensionAPI" 

onInit: function () { 
     ExtensionAPI.getExtensionAPIPromise(this.getView()).then(function (oExtensionAPI) { 
           oExtensionAPI.attachPageDataLoaded(function (event) { 
                 this.getView().byId('edit').setVisible(false);
           }.bind(this)); 
      }.bind(this)) 
 }

Regards, Luiz Eduardo

Nadeem_Mohammed
Explorer
0 Kudos

What if for instance, we want to disable the Edit option that users can edit content based on the Order Status field.

luizems
Explorer

You can get the status and valid to set visible or not, like this:

var sPath = event.context.sPath,
oData = event.context.getModel().getProperty(sPath);
if( oData.status === true ) this.getView().byId('edit').setVisible(false);
else this.getView().byId('edit').setVisible(true);

Regards, Luiz Eduardo

aadizarobi
Explorer
0 Kudos

Hi Nadeem,

If you are using Behaviour Definition just commit out update command from your behaviour definition like below as i am using the same.

or if you want this as dynamic then just follow the same

pleasse mark as "Answered and closed". if solution is helpfull.

Regard ,

Adnan Khan