1. #1
    Sencha User
    Join Date
    Jan 2009
    Location
    Ottawa, ON, Canada
    Posts
    81
    Answers
    6
    Vote Rating
    1
    myExtJsUname is on a distinguished road

      0  

    Default Answered: Can I set Ext.form.Labelable.prototype.labelSeparator?

    Answered: Can I set Ext.form.Labelable.prototype.labelSeparator?


    Hello all,
    After ExtJs has loaded, I've tried setting the labelSeparator string as:
    Code:
    // 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:
    Code:
                this.myTextField = Ext.create(
                    "Ext.form.field.Text"
                    ,{
                        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.

    Cheers,
    jtm

  2. 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. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,605
    Answers
    543
    Vote Rating
    326
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    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.

  4. #3
    Sencha User
    Join Date
    Jan 2009
    Location
    Ottawa, ON, Canada
    Posts
    81
    Answers
    6
    Vote Rating
    1
    myExtJsUname is on a distinguished road

      0  

    Default


    Perfect, skirtle!!
    Code:
    Ext.form.field.Base.prototype.labelSeparator = " : ";
    Thank you for your quick response!
    jtm

Thread Participants: 1