openui5 js view addStyleClass

笑着哭i 提交于 2019-12-30 04:46:10

问题


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?


回答1:


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");


来源:https://stackoverflow.com/questions/29508061/openui5-js-view-addstyleclass

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!