We need the reference to call addStyleClass to apply our own CSS style. The normal approach is to obtain the button id first and then call this.getView().byId("<button id>"). The button definition is returned by controller method getHeaderFooterOptions. Unfortunately within this method the button id is not available yet.
However if you continue to debug the UI5 framework about button instance population, you can find a way to get "Follow up" button reference by the path highlighted below.
As a result we can simply write the following code:
onAfterRendering: function() {
var oEditButton = this._oControlStore.oButtonListHelper.aButtons[1].oButton;
oEditButton.addStyleClass("jerryButton");
},
In the view where "Follow Up" button is located, create a new namespace "html" and a new CSS style.
in the runtime, we can see that our custom CSS style takes effect:
I have discussed this requirement and my implementation with my colleague jwu01 and I realized the current one is not the best:
1. In the first step, I am using the private attribute _oControlStore of controller, which is not good. The attribute starting with "_" gives a hint that it is not intended to be used outside the context of its definition.
There is a better solution, using "public" getter method:
var oFooter = this.getView().getController().getPage().getFooter(),
oFollowBtn = oFooter.getContentRight()[1];
jQuery.sap.includeStyleSheet(jQuery.sap.getModulePath("cus.crm.opportunity.css.Opportunity", ".css"), "sap-ui-theme-sap.crm");
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
17 | |
13 | |
12 | |
11 | |
11 | |
11 | |
9 | |
9 | |
9 | |
6 |