PDA

View Full Version : button pressedCls doing problems



pinidbest
15 Oct 2012, 12:08 AM
Hi all, I am trying to do a very simple thing
I have a button that when pressed needs to change its icon

The button code looks like this:


xtype: "button",
iconCls: "chart-toolbar-btn-average",
pressedCls: "chart-toolbar-btn-average-pressed",
enableToggle: true,
pressed: true


And the CSS looks like this:




.chart-toolbar-btn-average{
background-image: url('../images/ContactsChart/GraphBar.png');
background-repeat:no-repeat;
width:16px; height:16px;
}
.x-chart-toolbar-btn-average-pressed
{
background-image: url('../images/ContactsChart/GraphBar_on.png');
background-repeat:no-repeat;
width:16px;
height:16px;
}



I have tried without the x- prefix and it doesnt work as well
Any ideas

mitchellsimoens
22 Oct 2012, 7:07 AM
Have you inspected the DOM to see where that class is added?

James Goddard
22 Oct 2012, 12:07 PM
x-chart-toolbar-btn-average-pressed != chart-toolbar-btn-average-pressed

Also note that both your class and your pressed class are at the same css specificity. I would make an effort to make your pressed rule more specific so that it is guaranteed to override the other rule when the button is pressed.