【发布时间】:2018-05-15 09:19:34
【问题描述】:
我尝试使用以下代码 https://docs.sencha.com/extjs/6.0.0/classic/Ext.form.field.Radio.html
尝试通过添加一些配置来隐藏其中一个无线电字段
boxLabel: 'XL',
name: 'size',
inputValue: 'xl',
id: 'radio3',
itemid: 'radio3Id'
并更改了一些代码
//if XL is selected, change to L
if (radio3.getValue()) {
radio2.setValue(true);
return;
Ext.ComponentQuery.query('#rad3').hidden(true);
}
//if nothing is set, set size to S
radio1.setValue(true);
Ext.ComponentQuery.query('#radio3Id').hidden(false);
但它不起作用。如何动态隐藏无线电场? 我不想使用 Ext.getCmp(),因为我打算删除无线电字段的 id 属性,并且使用 id 属性通常会在多次使用时导致错误。
已编辑 我尝试了答案,当我将 id 属性与 Ext.getCmp() 一起使用时,它们都可以正常工作。我希望这可以与参考或 itemId 一起使用。
【问题讨论】:
标签: javascript extjs