我有一个 ExtJS
窗口,其中有 2 个带有 checkboxgroups
的独立面板。
它们都显示相同的值,但用户无法从两个面板中选择相同的项目复选框组
。
当用户在另一个 checkboxgroup
中选择已选择的值时,我想处理这个问题,而不仅仅是在两个 ceckboxgroup
监听器中检查并发出警告。
为了避免警报,我想隐藏或禁用该框。
我尝试添加 hidden:true
或 disabled:true
但没有运气:
Ext.create('widget.window',
{
title : 'Select a value',
draggable : true,
modal : true,
closable : true,
closeAction : 'destroy',
width : 400,
height : 350,
layout:
{
type : 'hbox',
align : 'stretch'
},
items :
[{
xtype : 'panel',
title : 'Success',
autoScroll : true,
flex : 1,
items :
[{
xtype : 'checkboxgroup',
itemId : 'success',
columns : 1,
vertical : true,
items : yes_checkbox,
listeners :
{
change: function(field, newValue, oldValue, eOpts)
{
// newValue.rb
}
}
}]
},
{
xtype : 'panel',
id : 'panel_failure',
title : 'failure',
autoScroll : true,
flex : 1,
items :
[{
xtype : 'checkboxgroup',
itemId : 'failure',
columns : 1,
vertical : true,
items : no_checkbox,
listeners :
{
change: function(field, newValue, oldValue, eOpts)
{
// newValue.rb
}
}
}],
}],
});
我试图在 中获取像
监听器。但我无法确定Ext.getCmp('panel_failed').items.add(//something here)
这样的 panel_failed
更改add()
是否是正确的方法,如果是,在函数内部写入的格式是什么。
谢谢
最佳答案
您可以定义所有复选框的itemId
,然后可以使用setDisabled(true)
轻松选择和禁用它们;
关于javascript - 禁用选中一个复选框组中的复选框或隐藏另一复选框组中具有相同值的复选框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17777028/