I am trying to show/hide combo boxes on a panel based upon a radio group selection. However, the show, hide, setVisible methods do not seem to be working. I am using v 4.0.1
Following is the code -
Code:
Ext.define('Porto.view.report.Form', {
extend : 'Ext.form.Panel',
alias : 'widget.reportform',
width : 600,
autoHeight : true,
borders : false,
items : [ {
xtype : 'datefield',
fieldLabel : 'From',
name : 'fromDate',
format : 'Y-m-d',
allowBlank : false,
value : new Date()
}, {
xtype : 'datefield',
fieldLabel : 'To',
name : 'toDate',
format : 'Y-m-d',
allowBlank : false,
value : new Date()
}, {
xtype : 'radiogroup',
fieldLabel : 'Records',
columns : 1,
vertical : true,
id : 'dailyRecords',
items : [
{ boxLabel : 'Test Records',
name : 'recordType',
inputValue : 'testRecords',
checked : true
}, {
boxLabel : 'Other Records',
name : 'recordType',
inputValue : 'otherRecords',
}
],
listeners : {
change : function(radioGroup, radio) {
var checkedItem = radioGroup.getValue();
var checkedItemValue = checkedItem['recordType'];
if( checkedItemValue == "testRecords" ) {
Ext.getCmp('testTypeCombo').setVisible(true);
console.log("testRecords");
}
else if ( checkedItemValue == "otherRecords" ){
Ext.getCmp('testTypeCombo').setVisible(false);
console.log("otherRecords");
}
}
}
}, {
xtype : 'combo',
id : 'testTypeCombo',
name : 'testTypeCombo',
fieldLabel : 'Test',
emptyText : 'All',
store : 'TestTypes',
displayField : 'name',
editable : false
} ]
});
Can someone please point out the mistake?
Thanks!