How to change the background color of button in Footer area
Opportunity的s3在init的时候有加载custom css的文件
jQuery.sap.includeStyleSheet(jQuery.sap.getModulePath("cus.crm.opportunity.css.Opportunity", ".css"), "sap-ui-theme-sap.crm");
我往这个css文件里面加一个自定义的css class
.myAwesomeBtnBackgroundColor {
background-color: red;
}
之后就找出Target button然后将这个custom css class加载上去…
var oFooter = this.getView().getController().getPage().getFooter(),
oFollowBtn = oFooter.getContentRight()[1];
oFollowBtn.addStyleClass("myAwesomeBtnBackgroundColor");
我们遇到的问题是改button text的颜色,比如把你们例子中的“follow me”字体改成蓝色。
你们email中的核心思想是找到button然后通过addStyleClass() 来修改button的css
如果我的理解没有错误的话,我已经尝试过了,但是其实修改button的css style并不能改变button text的style。
我有一个button,id是”interactionButton”它的text是“0 Requests”,我要根据不同的情况还改变 button text的颜色。
看我截图黄色highlight部分,目前我们发现只有改” interactionButton-inner”或者“interactionButton-content”的css style才能改text 的颜色,改动button “interactionButton”是不work的
曾经尝试在controller.js 的onAfterRendering方法里面通过拿到this.getView().byId(“interactionButton-inner”)或者this.getView().byId(“interactionButton-content”)来change style,
但其实在onAfterRendering方法里面,interactionButton-inner和interactionButton-content 都还没有被render,所以尝试失败
目前我们一个非常ugly的solution如下,直接修改div。。我觉得这样不是个good solution。。。。
solution
首先看为什么byId, 传button id进去能够访问到button:
因此这里有两个维度的东西:
-
Ui5 control object – 通过上图line 307行生成。每个control object在core的this.mElements里拥有一行对应的entry。使用byId时,传入的id必须是ui5 control object的id,不能是native html tag的id。
-
Native html tag. 在AfterRendering之前,button对应的inner div tag在此处被render。其id的naming convention就是line 99行, button本身的id + “-inner”.
但是这个native html tag并不会注册到core的this.mElements去,因此byId() query不出来。
所以再回到你的需求,button的inner div这个实现对于我们application developer是透明的。如果我们要修改text color, 只能通过button 提供的API。
但是API 文档上button只有setText的功能,那我们先看看setText 是怎么被框架实现的?
通过读代码发现和你的实现一致。
因此我们可以得出一个generic的结论:
-
如果需求希望修改button的属性是UI5 layer的,换句话说属性能在这个button.js里找到,则直接用button reference的API修改
2. 否则,是native layer的属性,只用通过操作dom 解决。
相关文章
- Not enough information to list image symbols. Not enough information to list load addresses in …「建议收
- It is illegal to call this method if the current request is not in asynchron
- to program_I Just Want To
- ORA-00362: member is required to form a valid logfile in group string ORACLE 报错 故障修复 远程处理
- ORA-01719: outer join operator (+) not allowed in operand of OR or IN ORACLE 报错 故障修复 远程处理
- ORA-02195: Attempt to create string object in a string tablespace ORACLE 报错 故障修复 远程处理
- ORA-30736: objects in a table or view hierarchy have to be in the same schema ORACLE 报错 故障修复 远程处理
- ORA-30926: unable to get a stable set of rows in the source tables ORACLE 报错 故障修复 远程处理
- ORA-31692: The following SQL statement failed trying to insert a row into the Master table: string ORACLE 报错 故障修复 远程处理
- ORA-32342: The EXPLAIN_MVIEW facility failed to explain the materialized view statement ORACLE 报错 故障修复 远程处理
- ORA-39912: Partitioned index string.string in tablespace string points to table string.string in tablespace string outside of transportable set. ORACLE 报错 故障修复 远程处理
- ORA-54033: column to be modified is used in a virtual column expression ORACLE 报错 故障修复 远程处理
- ORA-01561: failed to remove all objects in the tablespace specified ORACLE 报错 故障修复 远程处理
- ORA-01761: DML operation does not map to a unique table in the join ORACLE 报错 故障修复 远程处理
- ORA-15153: cluster is not in the rolling upgrade to string ORACLE 报错 故障修复 远程处理
- ORA-15315: Write errors in disk group string could lead to inconsistent ASM metadata. ORACLE 报错 故障修复 远程处理
- ORA-16777: unable to find the destination entry of a standby database in V$ARCHIVE_DEST ORACLE 报错 故障修复 远程处理
- what is the difference of select single and select up to one row in abap详解编程语言
- MySQL语句如何分页?一步步教你实现!(Note: This article is written in Simplified Chinese. The title reads How to paginate MySQL statements? Let us guide you step by step! in English.)(分页mysql语句)
- MySQL中IN操作符的使用限制 最多能使用多少个(mysql中in的个数)
- 探索ORACLE中IN关键字的使用(in怎么使用oracle)
- 的影响Oracle中IN操作对索引效率的影响研究(oracle中in对索引)