Openui5 js view addStyleClass

How to set a class using mSetting?

For instance:

new sap.m.Button({}).addStyleClass("my-class"); //work 

Another way?

 new sap.m.Button({ styleClass: "my-class" // did'n work }); 

Any opportunity to set the class this way?

+5
source share
1 answer

At the moment (prior to version SAPUI5 1.28.4), styleClass is an unsupported property of sap.m.Button and its base type ( sap.ui.core.Control ). Therefore, you must use addStyleClass(sStyleClass) OR in the XML view directly.

As @Ivan said, you can use the busy property since it exists in the base type sap.ui.core.Control

We hope that this basic functionality will be available in higher versions.

Update: for multiple CSS classes

 var oLabel = new sap.m.Label({text:"Sample"}).addStyleClass("sample1 sample2"); 

OR

 var oLabel = new sap.m.Label({text:"Sample"}).addStyleClass("sample1").addStyleClass("sample2"); 
+6
source

All Articles