View Full Version : Chang color of a disabled text field
hieu79vn
3 Jul 2012, 8:24 AM
Hi
I would like to change the color of textfield when it's disabled. How can I do that?
Thank you
friend
3 Jul 2012, 9:23 AM
Take a look at the disabledCls (http://docs.sencha.com/ext-js/4-0/#%21/api/Ext.form.field.Text-cfg-disabledCls) config property.
hieu79vn
3 Jul 2012, 11:25 PM
Thank you friend ;)
hieu79vn
3 Jul 2012, 11:53 PM
Hi
I tried to do like this*
[{ xtype: 'textfield',
fieldLabel: 'To',
name: 'send_to',
disabledCls: 'af-item-disabled',
columnWidth: 1
}
]
and in css
.af-item-disabled{
color:#000 !important;
-webkit-text-fill-color: #000 !important;
background-color: Blue !important;
}
But it doesn't show the new format. Is there any problem?
sword-it
4 Jul 2012, 12:30 AM
Hi,
You can use 'addClass' function of textfield to modify its css even it is disabled
.sampleColorClass{ color:Blue; font-weight:bold; }
yourTextField.addClass('sampleColorClass');
Also you can remove it according to your needs by using removeClass() method.
For more details, check this http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.field.Text-method-addClass
hieu79vn
4 Jul 2012, 12:35 AM
Hi Sword-it. Thank you for your answer but maybe you misunderstand my question.
I want to add disabledCls class but I don't know how to write it in css file. I have tried with the above code but it doesn't have any affect
friend
5 Jul 2012, 4:20 AM
I think this:
background-color: Blue!important;
Should be this:
background-color: blue !important;
hieu79vn
5 Jul 2012, 11:37 PM
Thank you friend. you are moderator or user of this forum? I think you have many experience in EXTJS.
friend
6 Jul 2012, 5:02 AM
Just a user, with an Open Source, share-what-you-know mentality...
:]
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.