Skip to Content
0

How to extend sap.m.Page

Apr 19, 2017 at 11:50 AM

41

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Omri Cohen Apr 19, 2017 at 01:10 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded