View Full Version : Can I set Ext.form.Labelable.prototype.labelSeparator?

2 Oct 2012, 1:29 PM
Hello all,
After ExtJs has loaded, I've tried setting the labelSeparator string as:

// default value is ":"
Ext.form.Labelable.prototype.labelSeparator = " : ";

Unfortunately, though, I don't find this value gets used when I add a component with a label to a Window. For example:

this.myTextField = Ext.create(
fieldLabel: "Some label"

Will show "Some label:", not "Some label : ".

I've checked and my first line above is definitely changing the value stored for the labelSeparator, it just isn't using it. Is there a problem with my syntax above? Where I'm writing it to? When? I'm doing it within the Application's launch function.

BTW, I realize that I can set the labelSeparator within the config for the Ext.form.field.Text. I'm looking for a way to change them all so I don't need to worry if I miss some. And, it certainly seems like it should be possible to do this, so any ideas/pointers are welcome.


2 Oct 2012, 2:13 PM
Labelable is a mixin. Mixins get copied across when a class is defined, not when an instance is created, so by the time you update that value it's too late.

Try updating the value on Ext.form.field.Base instead.

3 Oct 2012, 6:48 AM
Perfect, skirtle!!

Ext.form.field.Base.prototype.labelSeparator = " : ";
Thank you for your quick response!