View Full Version : Changing extjs button color on click and toggle color between buttons

9 Jun 2011, 2:12 PM
In my application, I'm using a set of buttons on the west region of a border layout as menu buttons. I would like to know, how to change the button colors on click and retain the same color unless another button is pressed. When another button is clicked, it needs to change color, making it kind of toggle between them.
I came across code such as

function ChangeText()
then it doesn't workout.
I noticed it was be done easily for html buttons. Then is it anyway it can be done without changing the css in extjs?


10 Jun 2011, 7:05 AM
Are you aware of the enableToggle, toggleGroup and toggleHandler config options for a button? Should give you the effect you're looking for with very little effort.

If you really do want to make the button red like your example then you are going to have to dig into CSS. It's a little more complicated than that though because Ext uses a set of image sprites to render buttons consistently across browsers so you'd probably have to do some image editing too.