cancel
Showing results for 
Search instead for 
Did you mean: 

beforeShow event being wrongly called?

0 Kudos

Hello everyone,

I'm using a SplitApp and passing data (Master - > Detail) like this:

handleListSelect: function() { 

       var app = sap.ui.getCore().byId("app");

       var oContext = {};

       var start = sPath.lastIndexOf("=") + 1;

       oContext.listId = sPath.substring(start, sPath.length - 1);

       app.toDetail("detailId", "show", oContext);

       

    }

The SplitApp documentation OpenUI5 SDK - Demo Kit

"The "beforeShow" event on the target page will contain this data object as "data" property. "

So I've tried to call on my detail view the beforeShow

beforeShow: function(oEvent){

      var detail= oEvent.data.oContext;

      sap.m.MessageBox.alert(detail);

      console.log(detail);

    }

It seems that this function it's just being ignored when I run the application, no console or alert messages are shown. ( toDetail function still directs me to the Detail page and all the other functions run ok )

I've seen that are methods like onBeforeShow and I've tried to use them instead, but still isn't called.

Also only tried to console log oEvent.data to see what properties it had, but nothing was called.

Is the SplitApp documentation outdated or there is something wrong in the way I'm calling it?

Accepted Solutions (1)

Accepted Solutions (1)

santhu_gowdaz
Active Contributor
0 Kudos

Are you called onBeforeShow in Detail onInit() like this,

Passing value from List to detail in UI5 mobile... | SCN

ashok_dhayalaraj
Explorer
0 Kudos

Hi Santhosh,

For me, the onInit is working fine, as you have suggested. But when I call another item, I would like to know how I can get the next value to show in the detail page in a splitapp.

santhu_gowdaz
Active Contributor
0 Kudos

if i understood your quest properly, here is the ans,

In master controller,

var masterVal = //get the value to be passed  to detail.

app.to(screen, {masterVal : masterVal });


in detail oninit before show method,

  1. onInit: function() {
  2. var view = this.getView();   
  3. this.getView().addDelegate({
  4.             onBeforeShow: function(evt) {
  5.                var masterVal = evt.data.masterVal ;
  6.             }
  7.         });
  8.   },

Answers (0)