Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

openui5 js view addStyleClass

Tags:

sapui5

How can we set class with mSetting?

For example:

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

Another way?

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

Any possibility to set class that way?

like image 454
Ivan Avatar asked Apr 08 '15 07:04

Ivan


1 Answers

As of now (till version SAPUI5 1.28.4), styleClass is not a supported property of sap.m.Button nor its base type's( sap.ui.core.Control) property. Hence you have to use addStyleClass(sStyleClass) OR in XML view directly.

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

Hopefully we will this basic functionality in higher releases.

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");
like image 119
Sunil B N Avatar answered Sep 30 '22 21:09

Sunil B N