Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: change fieldLabel of Ext.form.Field

  1. #11
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,246
    Vote Rating
    118
      0  

    Default

    That's completely correct, but the 'label' property is only available in Ext 3.0.1 and up.

    So for older Ext versions you would use the code from post #7.

  2. #12
    Ext JS Premium Member Joyfulbob's Avatar
    Join Date
    Feb 2008
    Posts
    176
    Vote Rating
    1
      0  

    Default

    Quote Originally Posted by arefin View Post
    I used Ext.getCmp('daterange').label.update('Range '); and it works.
    Tell me if I am wrong.
    This works for me; thanks! We can use this a lot to reduce form size.

  3. #13
    Sencha Premium Member i.stojanovic's Avatar
    Join Date
    Oct 2010
    Location
    Kragujevac, Serbia
    Posts
    24
    Vote Rating
    1
      0  

    Default change fieldLabel in ExtJS 4

    Hi,

    If you want to change the label in ExtJS 4, here are solutions

    PHP Code:
    Ext.override(Ext.form.Field, {
        
    setFieldLabel : function(text) {
            if (
    this.renderedExt.get(this.labelEl.id).update(text);
            
    this.fieldLabel text;
        }
    }); 
    It is necessary to define an initial value for fieldLabel, can not be an empty string (  can)

  4. #14
    Sencha User
    Join Date
    Jan 2009
    Posts
    37
    Vote Rating
    0
      0  

    Default

    I think the method applyFieldLabel(value) should be overwritten... as explained in the article http://docs.sencha.com/ext-js/4-0/#!/guide/class_system



  5. #15
    Sencha User
    Join Date
    Aug 2011
    Posts
    1
    Vote Rating
    0
      0  

    Thumbs up

    Quote Originally Posted by arefin View Post
    I used Ext.getCmp('daterange').label.update('Range '); and it works.
    Tell me if I am wrong.
    thanxxx arefin... its workes great.....

  6. #16
    Sencha User
    Join Date
    Mar 2012
    Location
    Indonesia
    Posts
    1
    Vote Rating
    0
      0  

    Default

    For ExtJS 4 user, you can replace label with labelEl, if you want to use this line of code.

    Code:
    Ext.getCmp('field_id').label.update('text_to_change');
    replace with:

    Code:
    Ext.getCmp('field_id').labelEl.update('text_to_change');

    because, i tried with label and it not worked for me. but after replace label with labelEl, it works.

  7. #17
    Sencha User
    Join Date
    Oct 2012
    Posts
    30
    Vote Rating
    0
      0  

    Default

    Ext.getCmp('daterange').labelEl.update('Range '); works for me on Ext 4.0

  8. #18
    Sencha User
    Join Date
    Apr 2012
    Posts
    3
    Vote Rating
    0
      0  

    Default

    thank you very much
    cty thiet bi van phong pham chuyen mua ban v?n phng ph?m t?t c? ??u lam dep

  9. #19
    Sencha User
    Join Date
    Jul 2011
    Posts
    2
    Vote Rating
    0
      0  

    Default thanks

    Quote Originally Posted by Condor View Post
    I would recommend:
    Code:
    Ext.override(Ext.form.Field, {  setFieldLabel : function(text) {    if (this.rendered) {      this.el.up('.x-form-item', 10, true).child('.x-form-item-label').update(text);    }    this.fieldLabel = text;  }});
    thanks, completely works for ExtJS 3

  10. #20
    Sencha User
    Join Date
    Nov 2013
    Posts
    4
    Vote Rating
    0
      0  

    Default

    I've tried this but it only fire once. Why is that?

Page 2 of 2 FirstFirst 12

Posting Permissions

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