我尝试在不使用相同的name
配置的情况下在ExtJS中对单选按钮进行分组。这个是可能的吗?这是我的代码:
items:
[
{
xtype: 'radio',
name: 'is_self_employed',
boxLabel: 'Self Employed:'
},
{
xtype: 'radio',
name: 'is_voluntary',
boxLabel: 'Voluntary:'
},
{
xtype: 'radio',
name: 'is_ofw',
boxLabel: 'OFW:'
},
{
xtype: 'radio',
name: 'is_non_working_spouse',
boxLabel: 'Non Working Spouse:'
},
{
xtype: 'radio',
name: 'is_farmer_or_fisherman',
boxLabel: 'Farmer or Fisherman:'
}
]
发布于 2017-05-26 06:43:05
您想要具有不同名称的单选按钮?
单选按钮是按它们的名称分组的,这会破坏它们的功能,除非您执行一些JS代码来修复您破坏的部分。
发布于 2017-05-26 06:56:30
最好的方法是为所有无线电设置相同的名称,并为每个无线电设置不同的inputValue。
另一种可能的实现方式是在启用单选按钮的同时手动触发取消选中其他单选按钮。
listeners: {
change: function(rd, value) {
if (value) {
var radios = rd.up("form").query("radio");
Ext.each(radios, function(r) {
if (r != rd)
r.setValue(false);
});
}
}
}
https://stackoverflow.com/questions/44191746
复制相似问题