Results 1 to 3 of 3

Thread: How to update boxLabel for a radio button after rendering?

  1. #1
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    43
    Answers
    2

    Default Answered: How to update boxLabel for a radio button after rendering?

    I've looked in the debugger, and through all the code for the radio button, checkbox, and the Container classes.

    I did find a couple of old (3.X) forum answers on this, but that code doesn't work:

    Code:
    Ext.define('VFABRIC.form.RadioField', {
        extend: 'Ext.form.field.Radio',
        alias: 'widget.vfabricradiofield',
    
    
      setBoxLabel: function(boxLabel) {
        this.boxLabel = boxLabel;
        if (this.rendered) {
          this.wrap.child('.x-form-cb-label').update(boxLabel);
        }
      },
    
    
      constructor: function(config) {
            this.callSuper(arguments);  // calls superclass's constructor//...
      },
    
    
    });
    Is there a way to do this in 4.X of ExtJS?

    My workaround is to remove the radio button and re-add it, but that's pretty grody.

  2. This worked for me:

    Code:
    Ext.define('MyRadio', {
        extend : 'Ext.form.field.Radio',
        xtype  : 'myradio',
    
        setBoxLabel : function(label) {
            this.boxLabel = label;
    
            this.rendered && this.boxLabelEl.update(label);
        }
    });

  3. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,448
    Answers
    3997

    Default

    This worked for me:

    Code:
    Ext.define('MyRadio', {
        extend : 'Ext.form.field.Radio',
        xtype  : 'myradio',
    
        setBoxLabel : function(label) {
            this.boxLabel = label;
    
            this.rendered && this.boxLabelEl.update(label);
        }
    });
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

    Posts are my own, not any current, past or future employer's.

  4. #3
    Sencha Premium Member
    Join Date
    Aug 2012
    Posts
    43
    Answers
    2

    Default

    Awesome! Thanks so much.

    I spent quite a bit of time trying different things, this saves me a lot of time. Hopefully it will help someone else too.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •