繁体   English   中英

如何在extjs中的复选框上隐藏和显示文本字段

[英]How to hide and show textfield on checkbox in extjs

我试图显示和隐藏extjs中的文本字段,但我无法切换此代码。

        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);  

                }

            }
        }
    }
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);   
        }   
    }
}   

使用此代码。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM