sap.m.IconTabBar -- problem with formatter on iconColor property
It looks like the iconColor property binding does not update the icon color if a formatter is used.
To reproduce do the following: In controller build an example model:
var oModel = new sap.ui.model.json.JSONModel({
"Flag" : true
});
this.getView().setModel(oModel, "exp");
Build somewhere in the view a checkbox like that: new sap.m.CheckBox({ selected : "{exp>/Flag}" }),
Build somewhere else in the same view an sap.m.IconTabBar with at least one item like that:
new sap.m.IconTabBar({
items : [
new sap.m.IconTabFilter({
text : "Text",
iconColor : {
path : "exp>/Flag",
formatter : function(oValue) {
if (oValue===true) {
return sap.ui.core.IconColor.Neutral;
}
return sap.ui.core.IconColor.Default;
}
},
enabled : true,
icon : "sap-icon://doctor",
content : [
new sap.m.Text({text : "Demo"})
]
}),
]
})
If you now check and unchecked the checkbox the color of the icon will not be updated correct. Or is something wrong with my code?
I could reproduce this problem with SAPUI5 1.28.x and SAPUI5 1.32.7
The only thing wrong with your code is the color choice: "Neutral" and "Default" look very similar. Try "Critical" instead: http://jsbin.com/yuveveloxa/1/edit?html,output
Regards Andreas
P.S.: Providing a jsbin example would have been helpful.
Looks like the bug is exactly there. If you use "neutral" and "default". Please add a further icon in your code, you will see the color of default and neutral is different. Hope that link works: http://jsbin.com/maziwuqiki/1/edit?html,output
I am using a theme (build with the theme designer) where colors for default and neutral are completely different. You are right if I use different combination it seems working, but not with this combination.
Ah, ok... I noticed the slight color change in the underline bar, so I used a vastly different color and it worked. But you are right that only the underline changes the color. The icon has both CSS classes: sapMITBFilterDefault and sapMITBFilterNeutral and due to the order in the CSS (I guess) neutral wins. That's a bug. Good find! Tracked internally as 1570870553.
Regards Andreas
Hi,
the fix will be available with the next patch for version 1.32.
Regards, Marin