Skip to Content

How to extend sap.m.Page

Hello Experts,

I'm trying to extend the sap.m.Page without success.

I extended it without using additional properties, the code looks like this:

"use strict";
jQuery.sap.declare("controls.MultiHeaderPage");
sap.m.Page.extend("controls.MultiHeaderPage", {
metadata : {
    properties : {
    multiHeader: {type : "string", defaultValue : ""}
    }
  },

  renderer: {}
});

In my xml I changed Page to MultiHeaderPage:

<mvc:View 
controllerName="x.main"
xmlns:core="sap.ui.core" 
xmlns:mvc="sap.ui.core.mvc" 
xmlns:custom="controls"
xmlns="sap.m">

<App id="app">
<pages>
<custom:MultiHeaderPage  showNavButton="false">
       <content>
      </content>
</custom:MultiHeaderPage>
</pages>
</App>
</mvc:View>

However I'm getting errors regarding the content aggregation:

Uncaught Error: failed to load 'sap/m/content.js' from...

What am I missing?

How can I extend to sap.m.Page?

sap.ui.version is 1.38.7

Regards, Omri

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 19, 2017 at 01:10 PM

    Solved it on my own.

    When extending control that has aggregations we should use the prefix for each aggregation so instead of <custom:content> one should use <custom:content>

    Omri

    Add comment
    10|10000 characters needed characters exceeded