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

How to open ObjectPage in edit mode in odata V4

SP321
Discoverer
0 Kudos
96

I have implemented the same settings as following doc but it doesnt work, I am trying to open sap.fe.templates.ObjectPage.Component in edit while navigating from list page, anyone know nay setting iam missing?

https://sapui5.hana.ondemand.com/#/topic/8665847a17a14e1abdcebe3e235c8c68

Appreciate the help!

Accepted Solutions (0)

Answers (2)

Answers (2)

Marian_Zeis
Active Contributor
0 Kudos

I created a sample how to do it here:

https://github.com/gregorwolf/bookshop-demo/pull/123/files

sap.ui.define(
    ['sap/ui/core/mvc/ControllerExtension'],
    function (ControllerExtension) {
      'use strict';
  
      return ControllerExtension.extend('orders.ext.ObjectPageExt', {
        override: {
          routing: {
            // Method to handle the binding context set up after navigation to this view.
            onAfterBinding: function (bindingContext) {
              // Update the button state based on the new binding context.
              // Get the current binding context of the view.
              const bindingContext2 = this.base.getView().getBindingContext();
              if(bindingContext.getBinding().getPath().startsWith("/Orders")){
                bindingContext2.requestObject().then(
                  function (dataObject) {
                    this.base.editFlow.editDocument(bindingContext2)
                  }.bind(this)
                );
              }
              },
          }
        }
      });
    } 
  );
  
junwu
SAP Champion
SAP Champion
0 Kudos

is your odata draft enabled?

SP321
Discoverer
0 Kudos
yes