1. #11
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    1. Put this directly after including ext-all.js:
    Code:
    Ext.override(Ext.form.Field, {
       setFieldLabel : function(text) {
          this.el.up('.x-form-item', 10, true).child('.x-form-item-label').update(text);
       }
    });
    2. Use:
    Code:
    Ext.getCmp('id-of-your-text-field').setFieldLabel('other label');

  2. #12
    Ext User skaue's Avatar
    Join Date
    Sep 2008
    Location
    Troms
    Posts
    191
    Vote Rating
    0
    skaue is on a distinguished road

      0  

    Default


    Hmm.. got it to work now... It might be the fact that this label was in a popup window (with a form), and I needed to actually display the form first, then I can update the element.

    Yea, that would make sense, and I need to stay sane about this

  3. #13
    Sencha - Community Support Team Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,251
    Vote Rating
    73
    Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold Condor is a splendid one to behold

      0  

    Default


    OK, how about this then:
    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);
    		} else {
    			this.fieldLabel = text;
    		}
    	}
    });

  4. #14
    Ext User skaue's Avatar
    Join Date
    Sep 2008
    Location
    Troms
    Posts
    191
    Vote Rating
    0
    skaue is on a distinguished road

      0  

    Default


    yea... thats even more clever... now tell me; why isn't this a part of the API?

  5. #15
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,126
    Vote Rating
    516
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    Because the form layout is in charge of rendering the labels on form fields. It's a little weird.
    Evan Trimboli
    Sencha Developer
    Twitter - @evantrimboli
    Don't be afraid of the source code!

  6. #16
    Ext User skaue's Avatar
    Join Date
    Sep 2008
    Location
    Troms
    Posts
    191
    Vote Rating
    0
    skaue is on a distinguished road

      0  

    Default


    well.. as long as Condor is around to hand his elite help

  7. #17
    Ext User
    Join Date
    Jan 2008
    Location
    Moscow, Russia
    Posts
    27
    Vote Rating
    0
    sksoft is on a distinguished road

      0  

    Default The final version

    The final version


    All of you forgot about labelSeparator
    Try to make it carefully...

    Code:
    Ext.override(Ext.form.Field, {
        setFieldLabel: function(text) {
            if (this.rendered) {
                var labelSeparator = this.labelSeparator;
    
                if (typeof labelSeparator == 'undefined') {
                    if (this.ownerCt && this.ownerCt.layout && typeof this.ownerCt.layout.labelSeparator != 'undefined')
                        labelSeparator = this.ownerCt.layout.labelSeparator;
                    else
                        labelSeparator = '';
                }
    
                var formItem = this.el.up('.x-form-item', 10);
    
                if (formItem) {
                    var label = formItem.child('.x-form-item-label');
    
                    if (label)
                        label.update(text + labelSeparator);
                }
            } else
                this.fieldLabel = text;
        }
    });

  8. #18
    Sencha User
    Join Date
    Mar 2011
    Location
    Brazil
    Posts
    1
    Vote Rating
    0
    marcio.freitas is on a distinguished road

      0  

    Post This is more flexible:

    This is more flexible:


    Code:

    Ext.override(Ext.form.Field, {
    setFieldLabel: function(text) {
    if (this.rendered) {
    var labelSeparator = this.labelSeparator;

    if (typeof labelSeparator == 'undefined') {
    if (this.ownerCt && this.ownerCt.layout && typeof this.ownerCt.layout.labelSeparator != 'undefined')
    labelSeparator = this.ownerCt.layout.labelSeparator;
    else
    labelSeparator = '';
    }

    var formItem = this.el.up('.x-form-item', 10);

    if (formItem) {
    var label = formItem.child('.x-form-item-label');

    if (label)
    label.update(text + labelSeparator);
    }
    } else
    this.fieldLabel = text;
    }
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar