PDA

View Full Version : checkboxgroup: change style of fieldlabel?



amaunz
8 Oct 2013, 1:23 AM
Hi, how can I change the style of the fieldlabel of a checkboxgroup? I can do


checkboxgroup.getEl().setStyle()

but that changes the style (e.g. color) for the whole thing, not just the fieldlabel.

Thanks

Farish
8 Oct 2013, 1:33 AM
one way is to use tags directly in the label text. E.g.


fieldLabel: '<b>Test</b>',

or you could add a span with a class and define the class in your stylesheet.

amaunz
8 Oct 2013, 1:39 AM
Thanks, but I would need a dynamic version, i.e. I want to change the style programmatically.

ettavolt
8 Oct 2013, 1:41 AM
Group is decorated with Labelable mixin, that has several settings for customizing label, e.g. labelStyle (http://docs.sencha.com/extjs/4.2.2/#!/api/Ext.form.Labelable-cfg-labelStyle).

amaunz
8 Oct 2013, 4:03 AM
I am sorry, but I'm lost. I see
labelStyle can be set in the config, but is there an interactive version, like a method I can call, e.g.
setLabelStyle?

amaunz
8 Oct 2013, 5:27 AM
Solved it using a combination of Ext.get and setStyle(). The label can be identified by its id, it has the appendix -labelEl.