0

I want to call a second View via the Targets function in my Detail View and also pass Data throught the first to the second View.

onListItemPressed: function(evt){
            var id = evt.getSource().getBindingContext().getProperty("PoNumber");
            this.getOwnerComponent().getTargets().display("MaterialDetailView", {
                data: id
            });
        } 

This works fine.

But I don't know how to get the passed Data in the second view and bind the data to the View. I can only find how to do it with a Route but I want to stick with the Target.

Any sugesstions?

Jaro
  • 1,757
  • 1
  • 15
  • 36
tobzilla90
  • 607
  • 5
  • 9

1 Answers1

0

you can pass the data in the onRouteMatched function after you call the second view. And read the data than..

Jünge alles
  • 491
  • 1
  • 5
  • 19
  • i tried this but I did not work for me. Maybe I made a mistake. Can you post some code here? – tobzilla90 Feb 11 '19 at 01:17
  • `onInit: function () { var that = this; var oRouter = sap.ui.core.UIComponent.getRouterFor(that); oRouter.getRoute("Details").attachMatched(that._onRouteMatched, that);},` thats the on init after that the function onRouteMatched will be called and `_onRouteMatched: function (oEvent) { var that = this; var oView; var oJsonModel = new sap.ui.model.json.JSONModel(); that._oArgs = oEvent.getParameter("arguments"); ` and you in oArgs are stored the data.. depends also on the object but in most cases this works – Jünge alles Feb 13 '19 at 16:00