I work with SAPUI5, and I want to add a style to an object as soon as I instantiate it. For example, I want to add styleclass 'foo' to my label inside my panel.
What I want to do, but doesn't work:
var oPanel = new sap.m.Panel({
content: new sap.m.Label({
text: "Hello",
styleClass: "foo"
})
});
What I don't want to do, but does work:
var oLabel = new sap.m.Label({
text: "Hello"
});
oLabel.addStyleClass("foo");
var oPanel = new sap.m.Panel({
content: oLabel
});