user3620515
user3620515

Reputation: 79

Right Button in Header (XML View) in Ui5

How can i add a button on the right side of an header in SAP Ui5 View. The View is in XML. Another View is in JavaScript.

The Code is:

return new sap.m.Page({
            enableScrolling: false,
            showHeader: true,
            headerContent: [
            ],
            headerContent : new sap.m.Button({
                                             icon: "sap-icon://sys-help-2",
                                             press : function() {
                                                app.to("idVersion", {id:"initial"});
                                             }
            }),
            title: "Application Test",
            content: [oTileContainer]
        });

The XML View is:

  <Page
    showHeader="true"
    id="idPage"
    title="Personal Information"
    showNavButton="true"
    navButtonTap="actBack"
    class="sapUiFioriObjectPage" >
    <!-- this CSS class add a standard spacing to all the page content -->
    <headerContent>
    .......
    </headerContent>

How do i add the button to show in Javascript, within the <headerContent> tag.

I cannot use CustomHeader as other pages will get this Content and it might affect them. Kindly suggest.

Upvotes: 1

Views: 7781

Answers (1)

user3620515
user3620515

Reputation: 79

awesome... i think no :D

but here is my solution:

  <Page
    title="....."
    showNavButton="true"
    navButtonTap="actBack"
    class="sapUiFioriObjectPage" >
    <!-- this CSS class add a standard spacing to all the page content -->
    <headerContent>
    </headerContent>
    <headerContent>
            <Button
                icon="sap-icon://sys-help-2"
                press="handleNavToInfo" />
  </headerContent>
    <content>
    .......

Upvotes: 4

Related Questions