on 01-11-2016 8:34 PM
Hi guys,
I'm trying to customize the color of an object status, I'm using this code:
in order to set a different status depending on a value, and it's working fine. The thing is I need to add other colors. Is it possible to add more colors? I saw that is possible to handle it in a <script> </script> area, but then I don't know how to use it with this example.
Any hint or tip will be very usefull.
Thanks in advance!
Andrés
Hi gurus,
finally I handle the different colors in the icon of the Object Status:
1. I create the classes to handle the color in the css file
2. Then the importante part, I use "onAfterRendering" to set the logic in order to use different colors, then I get the icon instance "item.$().find('.sapUiIcon');" and there I use the new class with "addClass"
3. What I get is something like this:
I stay with the doubt of how change the color of the status.
Thank you very much for your time!
Andrés
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
do you use sap.m.Table?
here is an example
this.byId("DashboardColumnListItem").addDelegate( {
onAfterRendering: function () {
if ( this.getBindingContext().getObject().Expedite )
{
this.$().css("background-color", "#FFCAD5");
}
}
}, false, this.byId("DashboardColumnListItem"), true);
<Table ....
<items>
<ColumnListItem id="DashboardColumnListItem"...
I agree with Maksim and Joshi. Refer this working example. http://plnkr.co/edit/8yWKJL9EbW7wuX5mjO1f?p=preview
Regards,
Karthik A
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andrés,
Try this.
oStatus.addStyleClass(sColor);
I hope it will work for you. In case it doesn't apply the color, use !important in your css class and try again.
Read the documentation for styling objects.
addStyleClass, toggleStyleClass, removeStyleClass
Cheers,
KK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
oStatus.addDelegate( {
onAfterRendering: function () {
if( CONDITION )
this.addStyleClass("customClassName");
}
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.