Any answer for ExtJS4 ??
Any answer for ExtJS4 ??
I finally resolved to changing the HTML in the DOM directly, the only way I got it working was
But why is there no setLabel() method for a checkbox...? For any field in a form this should be a standard function..Code:chkboxfld.el.dom.firstChild.lastChild.innerHTML = "new label";
maybe this is better:
var ckb = this.query('checkboxfield')[0]
ckb.boxLabelEl.dom.childNodes[0].nodeValue
In ExtJS 4, this seems to work:
Code:checkbox.getEl().down('.x-form-cb-label').update(newText);
I think this would be currently the best solution in ExtJS 4:
But there is a problem with sizing. If the new text is wider than the old one, the label element will not be resized which leads to an ugly line break. What would be the right way to force recalculating the width? checkbox.doComponentLayout() respectively doLayout() or doComponentLayout() of the ownerCt does not work. Has anyone an idea?Code:checkbox.boxLabelEl.update(newLabelText);
Apart from that a method like setBoxLabel() would be really nice.
I've tested it with a radio field instead of a checkbox. Do they behave different (their box label logic doesn't inherit from a common class).
I am also facing the same issue.
I am looking to write generic utility to set the fieldLabel for all the control type like checkbox,radio,textbox, etc.
Can some one let me know how can I do that ?
For textbox - getfieldLabel and setFieldLabel() working fine.
Dipak
Use:
checkbox.el.down('.x-form-cb-label').update('Your box label');
Try with
Ext.get('idOfBoxEl').dom.innerHTML = 'NewLabel'
Regards
URL