PDA

View Full Version : setIconCls is not reflecting its CSS



Alhuck
26 Mar 2014, 1:43 AM
Hello Folks, I am dynamically setting an iconCls for a menu item on click. The problem is the menu item is set with the iconCls CSS but its not reflecting immediately. When i refresh it, the iconCls is set and reflecting as expected.

Please suggest me some measures to solve the issue .

I want the menu item to set and reflect the iconCls CSS on mouse click


Thanks In advance!!

israelroldan
2 Apr 2014, 10:12 AM
This is more of an browser loading issue... your icon is not required by the browser until the menu is actually rendered, so the image is not available at that point. Possible solutions are: a) use a fontIcon, b) use the sprite pattern (shared with other parts of your app so it gets loaded) or c) explicitly load the image before the menu is rendered (i.e., in a hidden component that gets removed immediately)