Hide & Show Fileds and Labels in EXTJS 3.01
Code to hide and show both a field and label whenever a checkbox is select. Note as of 3.01 just hidden a field will cause its label to be hidden as well.
Before form rendering code add:
Ext.layout.FormLayout.prototype.trackLabels = true;
Checkbox that invokes the action:
xtype:'checkbox',
fieldLabel: '',
labelSeparator: '',
boxLabel: 'Use an existing GCC as a template',
name: 'use-existing-gcc',
id: 'use-existing-gcc',
onClick:function(el) {
if(this.getValue()==true) Ext.getCmp('field-to-toggle').show();
else Ext.getCmp('field-to-toggle').hide();
}
Tags: extjs 3.01, form, hide, show