如何在extjs中隐藏和显示复选框上的textfield
我试图在extjs中显示和隐藏文本字段,我无法切换此选项 下面是我的代码如何在extjs中隐藏和显示复选框上的textfield,extjs,Extjs,我试图在extjs中显示和隐藏文本字段,我无法切换此选项 下面是我的代码 xtype : 'checkbox', fieldLabel : 'Is WGVPN', id : 'isWGVPN-id', listeners: { change: function() { showGVPNCaseAsPerScenario(Ext.getCm
xtype : 'checkbox',
fieldLabel : 'Is WGVPN',
id : 'isWGVPN-id',
listeners:
{
change: function()
{
showGVPNCaseAsPerScenario(Ext.getCmp('isWGVPN-id').getvalue,Ext.getCmp('ethFreeVCGNumber-id'));
if(Ext.getCmp('isWGVPN-id').getvalue==true)
{
Ext.getCmp('ethFreeVCGNumber-id').disable();
Ext.getCmp('ethFreeVCGNumber-id').hide();
Ext.getCmp('ethFreeVCGNumber-id').up('.x-form-item').setDisplayed(false);
}
else
{
Ext.getCmp('ethFreeVCGNumber-id').enable();
Ext.getCmp('ethFreeVCGNumber-id').show();
Ext.getCmp('ethFreeVCGNumber-id').up('.x-form-item').setDisplayed(true);
}
}
}
}
使用此代码。只需将Ext.getCmp('isWGVPN-id')更改为Ext.getCmp('isWGVPN-id')。getvalue()虽然可以工作,但不会重新加载更改,要查看我正在移动窗口的更改,您可以尝试进行更改并更新layout(),以查看更改。注意:停止使用
Ext.getCmp()
触发组件的内部侦听器。改用此
。
xtype : 'checkbox',
fieldLabel : 'Is WGVPN',
id : 'isWGVPN-id',
listeners:
{
change: function(newValue,OldValue) {
if(newValue== true){
Ext.getCmp('ethFreeVCGNumber-id').setVisible(false);
} else{
Ext.getCmp('ethFreeVCGNumber-id').setVisible(true);
}
}
}