Ryan
Ryan

Reputation: 301

can not create icon in sap.m.page

How come I cant create icon in my page? it is only one app and one page but still doesnt work.

createContent : function(oController) {
        var app = new sap.m.App();
        var statusPage = sap.m.Page("statusPage",{
            title : "some app",
        });
        statusPage.setIcon("http://www.sap.com/global/ui/images/global/sap-logo.png");
        app.addPage(statusPage);
        return app;

    }

Upvotes: 0

Views: 2012

Answers (2)

mlenkeit
mlenkeit

Reputation: 311

If you want to add an icon to the title of the page, you'll need to use the customHeader aggregation of the Page control. Assign a Toolbar to it, in the Toolbar, you can add an icon button and the title. Note that the title property will not work anymore when using a customHeader.

So your control hierarchy will look something like: (controls starting with capital letter, aggregation starting with lower-case letter)

Page
    customHeader
        Toolbar
            content
                Button (with icon
                ToolbarSpacer
                Text
                ToolbarSpacer

Upvotes: 4

Jorg
Jorg

Reputation: 7250

The icon on sap.m.Page only ever set the NavButton, and has been deprecated. What version are you using? From the current documentation:

Deprecated:
Since version 1.20. Deprecated since the MVI theme is removed now. This property only affected the NavButton in that theme.

Upvotes: 1

Related Questions