extjs - Change color of checkbox field when checked -
i have check box field box label colored in green. need change color of boxlabel (say: yellow) when user checks checkbox. tried validating checkbox, doesnt work. suggestions?
xtype : 'checkbox', id: 'checkbox1', name : 'checkbox', style: 'background-color : #bcf5a9', boxlabel: 'mycheckbox' //i tried below handler function. doesnt work handler: function (checkbox, checked) { if (checked) { style : 'background-color: #ddd'; } }
if need change color of boxlabel, try way.
ext.create('ext.form.panel', { bodypadding: 10, title: 'checkbox test', items: [{ xtype: 'checkboxfield', id: 'checkbox1', name: 'checkbox', style: { color: 'green' }, boxlabel: 'mycheckbox', handler: function(checkbox, checked) { if (checked) { checkbox.el.setstyle("color","red"); //checkbox.setboxlabel('<span style="color:red">mycheckbox</span>'); } else { checkbox.el.setstyle("color","green"); //checkbox.setboxlabel('<span style="color:green">mycheckbox</span>'); } } }], renderto: ext.getbody() });
<script type="text/javascript" src="http://cdn.sencha.com/ext/gpl/4.2.0/ext-all.js"></script> <link rel="stylesheet" type="text/css" href="http://cdn.sencha.io/ext-4.2.0-gpl/resources/css/ext-all.css">
Comments
Post a Comment