PDA

View Full Version : How to set backgroundColor for combobox?



Karun Telu
31 Oct 2011, 8:07 PM
Hi,
Can any one help me how to change/set back ground color of 'ComboBox' dynamically.

Thanks in advance
Karun Kumar

netemp
31 Oct 2011, 10:57 PM
May be this link proves to be useful - http://www.sencha.com/forum/showthread.php?142422-How-to-change-background-color-of-form-field-on-focus

Karun Telu
31 Oct 2011, 11:05 PM
Hi netemp,
Thank you for your reply.
I would like to know how to change background color based on selection of combobox item.
Find below senerio:
Combobox store : "Red","Green",
If I choose Red then back ground color should change to Red
If I choose Green then back ground color should change to Green

Please help me in figuring this issue.

Thanks in advance
Karun

netemp
31 Oct 2011, 11:11 PM
Use the following in your combo-box:



listeners:{
select:function(combo, records){
var value = this.getValue();
if(value=='val_1'){
this.setFieldStyle('background:#FF0000');
}else if(value=='val_2'){
this.setFieldStyle('background:#00FF00');
}
}
}



You can replace val_1 and val_2 with your respective values.

Karun Telu
1 Nov 2011, 7:37 PM
Hi netemp,
Thank you very much for needful help.
It's working...=D>:)

netemp
2 Nov 2011, 12:13 AM
Glad could help Karun. Could you please close this thread by marking any one of the answer as correct one. Thanks.