cancel
Showing results for 
Search instead for 
Did you mean: 

How to extend sap.m.Page

former_member182374
Active Contributor
0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

former_member182374
Active Contributor

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

Answers (0)