PDA

View Full Version : default color change of button



soviet
13 Jun 2014, 2:34 AM
I have a button on the view
buttons: [{
xtype:'graybutton,'
text:'add rice',
name: 'addRice',
}]
I have defined a xtype of a customized button

Ext.define('grayButton', {
extend: 'Ext.button.Button',

xtype:'graybutton',
alias: 'widget.graybutton',
config: {
cls:'red-css',
}

});
I want my customized button xtype to override the default behavior of button.
right now , with this code , i am unable to change the default color.Please suggest

vardhan22
13 Jun 2014, 4:32 AM
Instead of


config: {
cls:'red-css'
}

use


cls:'red-css'

Use alias in definition, do not use xtype:'grayButton'

soviet
13 Jun 2014, 4:54 AM
My Bad for using alias and xtype together.

Thanks for Correcting me .

But "cls" is the Configuration Object of a Button so i think i need to put that inside config object itself..

Thanks for Your Reply

vardhan22
13 Jun 2014, 5:04 AM
The Configs, Methods, properties options given in DOCS says that these are the configuratiions, methods associated with Button. Like this example http://docs.sencha.com/extjs/4.2.0/#!/api/Ext.button.Button-cfg-listeners
It defines width, height, listeners configuration for Button.