Results 1 to 8 of 8

Thread: Changing fieldLabel dinamically ?

  1. #1
    Sencha User
    Join Date
    Jul 2008
    Posts
    51
    Vote Rating
    0
      0  

    Default Changing fieldLabel dinamically ?

    Hello,

    How do I change a field's fieldLabel dinamically, i.e. after the field has been rendered, in ExtJS 4.0 ?

    Thanks,
    Howe

  2. #2
    Sencha User
    Join Date
    Apr 2010
    Posts
    78
    Vote Rating
    1
      0  

    Default

    I suspect you'll have to doLayout on the form after changing the fieldLabel attribute - I can't see any easy way to get the dom element to force the change.

    But why would you do this?

    Rich

  3. #3
    Sencha User
    Join Date
    Jul 2008
    Posts
    51
    Vote Rating
    0
      0  

    Default

    I was expecting to have a less obvious (and resource-hungry) way. Need to do it because a I need to change a field's label, of course

    If anyone knows a better way, please tell me.

    Thanks.

  4. #4
    Sencha User
    Join Date
    Apr 2010
    Posts
    78
    Vote Rating
    1
      0  

    Default

    Sounds like you're trying to repurpose an existing form to take input for several different reasons. Sounds dodgy to me.

    Rich

  5. #5
    Sencha User
    Join Date
    Jul 2008
    Posts
    51
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by kskrumpet View Post
    Sounds like you're trying to repurpose an existing form to take input for several different reasons. Sounds dodgy to me.

    Rich
    Not really, just translating some labels.

    Howe

  6. #6
    Sencha User
    Join Date
    Apr 2010
    Posts
    78
    Vote Rating
    1
      0  

    Default

    May I suggest you have a locale file containing all the correct language strings as "variables" and use those for your labels - then your server can push the right locale file in response to the original request, or if someone wants to change the language on the fly you dynamically load the new locale and redraw the whole app?

    -- edit --
    It's late and I didn't think this one through - the on the fly bit wouldn't work 'cos changing the locale wouldn't change all the data in the Ext object structures...

  7. #7
    Sencha User
    Join Date
    Jul 2008
    Posts
    51
    Vote Rating
    0
      0  

    Default

    That's kind of what I already do, I was just trying to avoid to redraw the form.

    Thanks !
    Howe

  8. #8
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Vote Rating
    1271
      0  

    Default

    If you really wanted to, you could iterate through each item and then query down to the label and update that element. Make sure you change the fieldLabel property also.
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Posting Permissions

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