I am trying to assign a style for each icon in a List component.
The traditional way to assign an icon would be to use the icon field of the item renderer, which reads the value of “icon” property in your data, for example:
listData.addItem({label: "Logout", icon: "com.classpth.DefualtThemeLogoutIconClass"});
But i want the DefualtThemeLogoutIconClass to changed to another class: LightThemeLogoutIconClass when the theme is changed.
The only way to do this would be to use a style declaration containing a classReference to the icon, and change its the value in each of the CSS files of the various themes.
The question is, is there any way to assign this style to an icon in a List, something as easy as intuitive as list[0].getIcon().setStyle("styleName");
Thanks
I suggest you to extend your list with icon style and then use custom Item renderer with possibility switch an icon. So if
rendererIconstyle of your list changes you callinvalidateDisplayList()(instyleChanged()of a list) and then inupdateDisplayList()iterate all the renderers and assign new icons.