Reputation: 3823
I‘m trying to extend a class in a SAPUI5-way. I wrote a very basic version to see how it works. But i don‘t see the predefined title in this example:
var app;
sap.m.Page.extend("MyPage", {
title: "hi",
renderer: {}
});
app = new sap.m.App({
pages: new MyPage({
//title: "Hey there!"
})
});
app.placeAt("content");
I have an example here:
http://jsfiddle.net/DerZyklop/76y4m6f0/4/
Upvotes: 0
Views: 367
Reputation: 4920
Your definition is incorrect; according to topic/7b52540d9d8c4e00b9723151622bbb64, you should specify default value for control metadata as follows:
metadata: {
properties: {
"title": {
type: "string",
group: "Data",
defaultValue: "Hi"
}
}
},
Upvotes: 2
Reputation: 21
if you want the define property with default value you can try this way.
sap.m.Page.extend("MyPage", {
metadata : {
properties : {
title : {type : "string", group : "Data", defaultValue : "hi"}
}
},
renderer: {}
});
Unfortunately in page control title property is set in it's "setTitle" method and not in the renderer. And when default value is set the "setTitle" property is not called. So you can try to call it on init.
sap.m.Page.extend("MyPage", {
init: function () {
this.setTitle("hi");
},
renderer: {}
});
Is this proper solution for your problem?
Upvotes: 0