Master menu is not visible on mobile devices but i

2019-05-26 13:13发布

I have created a split app using the sap.m.SplitApp control.

Mobile Device:

enter image description here

iPad:

enter image description here

标签: sapui5
2条回答
在下西门庆
2楼-- · 2019-05-26 13:37

hi every one i found the solution: on XML view : you must put true to the property showheader for the page ypu want to see the button fo navigate and implemet the handle method for mavigate

<Page id="detail"
        showHeader="true"
       showNavButton = "true"  navButtonPress = "handleNav"
查看更多
劳资没心,怎么记你
3楼-- · 2019-05-26 13:55

I believe this is the intended behaviour.

See this github issue: https://github.com/SAP/openui5/issues/30

One of the devs says

The SplitApp is designed to behave like e.g. the "Settings" app on iPhone, where a master-detail structure on tablet is mapped to a linear set of pages on phone. As such it is correct not to display a "Show Master" button.

However, they suggest the following

On phones there is no master button, but you should initially see the master area and navigate from there to the detail area by selecting items.

To achieve this you can do the following: Your detail pages should contain a button with which you can navigate back to the master view (this button should only be visible if the device is a phone):

<Page id="detailPage" showNavButton="{device>/isPhone}" navButtonPress="handleNavButtonPress">
</Page>

The navButtonPress handler is implemented in your detail view's controller

handleNavButtonPress: function () {
    var oSplitApp = this.getView().getParent().getParent();
    var oMaster = oSplitApp.getMasterPages()[0];
    oSplitApp.toMaster(oMaster, "flip");
}

The device model I used can be implemented as follows (place this code in the init of your Component.js

var deviceModel = new sap.ui.model.json.JSONModel({
    isPhone: sap.ui.Device.system.phone
});
this.setModel(deviceModel, "device");

See this resource for further information: http://help.sap.com/saphelp_hanaplatform/helpdata/en/32/5b8edafcfa4c9c8fbd42455a60e379/content.htm

查看更多
登录 后发表回答