19 May 2011 12:57 PM #1
Changing fieldLabel dinamically ?
How do I change a field's fieldLabel dinamically, i.e. after the field has been rendered, in ExtJS 4.0 ?
19 May 2011 1:17 PM #2
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?
19 May 2011 1:21 PM #3
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.
19 May 2011 1:25 PM #4
Sounds like you're trying to repurpose an existing form to take input for several different reasons. Sounds dodgy to me.
19 May 2011 1:29 PM #5
19 May 2011 1:38 PM #6
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...
19 May 2011 1:43 PM #7
That's kind of what I already do, I was just trying to avoid to redraw the form.
20 May 2011 4:52 AM #8
- Join Date
- Mar 2007
- Gainesville, FL
- Vote Rating
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
Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/
Need more help with your app? Hire Sencha Services email@example.com
Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!
When posting code, please use BBCode's CODE tags.