Results 1 to 5 of 5

Thread: Need to change the boxLabel of Radio at runtime

  1. #1

    Default Need to change the boxLabel of Radio at runtime

    Hi,

    I need to change the boxLabel of a radio at runtime.
    I did this overriding for this purpose, that is working fine. But I am new to ExtJS, so I want to know is there any better way than this to achieve this need.

    Code:
     Ext.override(Ext.form.Radio,
        {
            setBoxLabel: function(label)
            {
                var labelEl=this.el.next("label");
                if (labelEl)
                    labelEl.update(label);
            }
        });

  2. #2
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246

    Default

    Use:
    Code:
    Ext.override(Ext.form.Checkbox, {
      setBoxLabel: function(boxLabel){
        this.boxLabel = boxLabel;
        if(this.rendered){
          this.wrap.child('.x-form-cb-label').update(boxLabel);
        }
      }
    });
    (Ext.form.Radio descends from Ext.form.Checkbox)

  3. #3

    Default

    Thanks for the info

  4. #4

    Default Thanks

    Thank you very much , got the whole idea, get the wrapper parent element using this.wrap, and find label element using class attribute,
    Code:
    <div>
    <input ...> //checkbox or its descendent
    <label class="x-form-cb-label" ...> box label </label>
    </div>
    and then change the value of the label element.
    Great thanks.

  5. #5
    Sencha User
    Join Date
    Jan 2011
    Posts
    26

    Default Setting a box label at runtime

    Where does this code go in the source?

Posting Permissions

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