如何操作SAP UI5應用Footer區域工具欄按鈕的背景顏色
Recently I get a customer requirement to remove the background color of edit button in footer toolbar:
The expected behavior:
The screenshot is made from CRM Fiori application “My Opportunity”. Customer are using it in their Android device. They complained since the button in Android platform will have blue as its background color automatically when clicked, so it is difficult to judge whether a button with blue background itself is actually clicked or not.
Here below is my analysis process how to achieve the customer requirement.
(1) First of all, we need to figure out how the blue background color is implemented in the standard application. Check related controller code regarding footer toolbar button definition, and there is no style definition regarding Edit button. So it must definitely be done by UI5 framework.
Use Chrome development tool, figure out which native html element is responsible for edit button rendering.
And then we find this CSS class div.sapMBtnInner.sapMBtnEmphasized has controlled the button style.
It should easily be verified, since we de-select the checkbox for property “background-color” and the appearance of Edit button is just what we expect.
(2) Now we need to know how this CSS style is added by UI5 framework. Search by keyword “Emphasized” and I just find what I look for in a second. In line 80 there is an IF evaluation to check the availability of oEditBtn of variable oController._oHeaderFooterOptions, whose value is filled by we application code. It means if application has explicitly declared the edit button, it is set with style = Emphasized automatically in line 87.
Then solution is found: just manipulate the oHeaderFooterOptions by implementing extension hook:
extendHeaderFooterOptions : function(oHeaderFooterOptions) {
var that = this;
oHeaderFooterOptions.buttonList.splice(0, 0, {sI18nBtnTxt : "EDIT",
onBtnPressed : function(evt) {
that.onEdit();
},
bEnabled : true
});
oHeaderFooterOptions.oEditBtn = null;
},
The idea is to clear the oHeaderFooterOptions.oEditBtn manuall so that the IF evaluation in line 80 will not succeed, and then we jut define the Edit button as “normal” button by inserting it into the array oHeaderFooterOptions.buttonList. However while testing, it is found that every time you navigate to Edit mode and then back, there will be a new Edit button generated in toolbar.
The solution is to simply introduce a Boolean variable to ensure the Edit button insertion is only executed once:
extendHeaderFooterOptions : function(oHeaderFooterOptions) {
if( this.bEditButtonDefined)
return;
this.bEditButtonDefined = true;
var that = this;
oHeaderFooterOptions.buttonList.splice(0, 0, {sI18nBtnTxt : "EDIT",
onBtnPressed : function(evt) {
that.onEdit();
},
bEnabled : true
});
oHeaderFooterOptions.oEditBtn = null;
}
If you would like to change the button’s background color to any other color, please refer to this blog: How to change the background color of button in Footer area
要獲取更多Jerry的原創文章,請關注公眾號"汪子熙":
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24475491/viewspace-2717883/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- SAP UI5 按鈕的型別和背景色設定例子UI型別
- 短視訊開發,點選按鈕Button,更換背景顏色
- 如何給 SAP Fiori Elements 應用新增自定義按鈕
- HTML連載79-背景圖片定位區域屬性、背景顏色HTML
- 如何在 SAP Fiori Elements List Report 表格工具欄裡增添新的自定義按鈕
- SAP Commerce Cloud Spartacus UI footer 區域的設計模型CloudUI模型
- 如何啟用SAP CRM附件UI上的advanced按鈕UI
- 選中按鈕改變文字大小和顏色
- 設定toast的字型顏色和背景顏色AST
- 換個按鈕顏色, 就能增長百萬使用者?
- 異形按鈕的點選區域處理
- CSS樣式中顏色與顏色值的應用CSS
- Qt5.9中QSS(qt Style Sheet)用法之一設定按鈕顏色和背景色(設定按鈕間相互間隔、設定按鈕與周圍邊緣間隔)QT
- 飲料瓶顏色區域擬合
- 視訊直播app原始碼,按鈕被按下時顏色隨著改變APP原始碼
- Flutter改變狀態列字型、狀態列背景顏色、Appbar背景顏色的方式FlutterAPP
- SAP UI5裡Batch操作和Read操作的區別UIBAT
- 使用 SAP UI5 CLI 命令列工具構建和執行 SAP UI5 應用UI命令列
- 如何為資料行的新增操作按鈕
- CSS 中的顏色、背景和剪下CSS
- CSS設定元素的背景顏色CSS
- SAP UI5 應用開發教程之七十 - 如何使用按鈕控制元件觸發頁面路由跳轉試讀版UI控制元件路由
- 快速搭建直播平臺,點選按鈕(Button)後改變顏色
- VC 對話方塊背景顏色、控制元件顏色控制元件
- SAP UI5 應用開發教程之一百零六 - 如何提高 SAP UI5 應用路由 url 的可讀性UI路由
- 使用 Busy Dialog 動畫阻止 SAP UI5 應用按鈕短時間內快速被點選試讀版動畫UI
- 更改NavMenu 導航選單啟用時的背景顏色
- VBA命令按鈕操作
- cad填充顏色怎麼操作 CAD如何給圖形填充顏色
- vscode如何更改背景顏色主題,黑色或白色?VSCode
- win10 如何設定txt背景綠色 win10如何在txt文件修改背景顏色Win10
- 如何分析SAP UI5應用的undefined is not a function錯誤UIUndefinedFunction
- 如何提取SAP UI5應用的技術資訊UI
- 強大的CSS:顏色、背景和剪下CSS
- 在 SAP BAS 裡使用 SAP UI5 應用消費 OData 的 Create 和 Delete 操作UIdelete
- 如何提取網頁上的顏色,網頁顏色程式碼提取工具ColorWell網頁
- win10系統如何設定Word背景顏色_win10 word頁面背景顏色設定步驟Win10
- 關於 SAP UI5 floating footer 顯示與否的單步除錯以及使用 SAP UI5 的收益UI除錯