-2

I'm working on a SAPUI5 App showing some data in a MasterDetailView using the sap.m.splitapp. My Problem is quit equal to the question Master menu is not visible on mobile devices but is visible on tablet.

In my case, I have the situation, that I'm going to create a MasterPage with a MasterController depending on requested data. Depending on these data I create dynamically the DetailPages in a function of the MasterController.

for(var i=0;i<adata.inhaltList.length;i++){var DetailPage = new sap.m.Page({
            title: masterString,
            showNavButton: true,
            navButtonPress:function () {
               var oSplitApp = this.getView().getParent().getParent();
               var oMaster = oSplitApp.getMasterPages()[0];
               oSplitApp.toMaster(oMaster, "flip");
            }
        });        };

On my test device, everything is working fine except the fact, that I have no possibility to show the MasterPage, even no Button is shown.

I have tried the solution of th linked question, but I get the error: "Object Element sap.m.Page#__page0 has no method 'getView'". So it didn't work. Even a Do-it-yourselve solution, adding a button in a custom-Header:

contentLeft: [new sap.m.Button({
    icon: "sap-icon://paging",
    press: function() {
        var splitApp = sap.ui.getCore().byId("ContentApp");
        if (splitApp.isMasterShown()) {
            console.log("Master weg");
            splitApp.hideMaster();
        } else {
            console.log("Master kommt");
            splitApp.showMaster();
            var oSplitApp = this.getView().getParent().getParent();
            var oMaster = oSplitApp.getMasterPages()[0];
            oSplitApp.toMaster(oMaster, "flip");
        };
    }
})]

and trying to show the Master manually didn't work.

The SAPUI5 function: oSplitApp.showMaster(); works fine in the explorer but not on the device! Does anybody knows why? And has probably a solution?

Community
  • 1
  • 1
Yvonne Marggraf
  • 368
  • 2
  • 5
  • 18
  • You already have the splitApp (`sap.ui.getCore().byId("ContentApp");`) and then you fetch the splitApp again (`this.getView().getParent().getParent();`). Just reuse your first object if the second doesn't work. Also you are creating your views via JS and not XML, that's why copy-pasting my code doesn't work. My code is intended to run in the controller, not directly in the view. Try to separate view from actual logic. – Marc Nov 21 '16 at 10:46
  • also in that case: "Uncaught TypeError: this.getView is not a function". So it didn't depends on the creating the DetailView in the Master-controller – Yvonne Marggraf Nov 21 '16 at 11:28

1 Answers1

1

I've found it out:

Even with the postet "tricks", the SplittApp class is not available for the Phone category. So, to see the masterView, I have created a PopUpMenu, which looks like the MasterPage.

Everything fine know and thank you for downgrading my question, because nobody knows that exactly.

Yvonne Marggraf
  • 368
  • 2
  • 5
  • 18