PDA

View Full Version : Changing the color/style of just one button.



sheikyerbootie
24 Jan 2011, 7:07 AM
Hi,

I've seen this post in the forums that explains how to change the style of a button and the code works fine, but it changes the style for all buttons (as they all have the style button.x-btn-text applied). Is it possible to just change the text of a single button without affecting all others on the page - I want to highlight a save button when changes have been made.

The original post was:

Specify a ctCls in your buttons config, for example:



{
text:'Submit',
ctCls: 'mybtn'
}
Then add the appropriate style to your style sheet:


.mybtn button.x-btn-text {
// your styles here
} That would be a way to do it on a per button basis, if you wanted to change all buttons you could just override the button.x-btn-text style.

sheikyerbootie
27 Jan 2011, 8:50 AM
Resolved - first of all I had declared the buttons as xtype's in a Ext.TabPanel so applying any cls to a button applied it to all buttons, so replacing them with previously created Ext.Button()'s and then setting the required buttons cls: (not the container class ctCls) to the CSS mybtn as described above did the trick.