Hybrid View
-
20 Jun 2009 5:51 PM #1
Set Checkbox boxLabel dynamically
Set Checkbox boxLabel dynamically
I want to change the Label for a Checkbox dynamically. I have tried:
Ext.get('cb_folders').update( 'New Label' );
which gives an "Unknown runtime error" in IE8 and does nothing in Firefox and Firebug reports no errors.
This seems like it should be simple to accomplish. I have searched the forums and tried everything I can think of without success.
The config is:
Code:var fp = new Ext.FormPanel({ frame: true, bodyStyle: 'padding:5px 5px 0', height: 110, anchor: '100%', items: [ { xtype: 'label', text: 'Search in:' }, { xtype: 'checkboxgroup', id: 'search-in', hideLabel: true, autoWidth: true, columns : [66, 66], items: [ { boxLabel: 'Folders', id: 'cb_folders', handler: function( checkbox, checked ) { checkbox_handler( checkbox, checked ); } }, { boxLabel: 'Articles', id: 'cb_articles', checked: true, handler: function( checkbox, checked ) { checkbox_handler( checkbox, checked ); } } ] }, ...Neville Franks, http://blog.surfulater.com
-
22 Jun 2009 1:12 PM #2
I've made no further progress with this, can anyone help.
Neville Franks, http://blog.surfulater.com
-
23 Jun 2009 11:15 AM #3
Same problem here... I have not been able to do this.
-
24 Jun 2009 3:31 AM #4
Ext.form.CheckBox does not have a method to do this. You would need to change the value of the <label> that Ext creates when it makes a cbox and also use the setRawValue method to keep them in synch.
Wouldn't it be easier to have two cboxes and toggle their visibility?
-
24 Jun 2009 3:45 AM #5Sencha - Community Support Team
- Join Date
- Mar 2007
- Location
- The Netherlands
- Posts
- 24,251
- Vote Rating
- 40
Try:
Code:checkbox.wrap.child('.x-form-cb-label').update('other boxLabel');
-
24 Jun 2009 3:53 AM #6
Hi Condor,
the doco says wrap "Creates and wraps this element with another element ".
Don't suppose you could explain that in English if you have a second?
-
24 Jun 2009 1:28 PM #7
Neville Franks, http://blog.surfulater.com


Reply With Quote