【发布时间】:2015-02-12 07:51:48
【问题描述】:
有两个组合框和一个按钮。我想要一个验证,即如果选择了“combo1”,那么应该启用“combo2”,当我选择“combo2”时,应该启用浏览按钮。
【问题讨论】:
-
到目前为止你有没有编写任何代码?
有两个组合框和一个按钮。我想要一个验证,即如果选择了“combo1”,那么应该启用“combo2”,当我选择“combo2”时,应该启用浏览按钮。
【问题讨论】:
类似的东西(在第一个组合框上插入文本):
combobox2 和按钮必须有这样的配置:
hidden:true,
disabled:true,
在组合框 1 上:
listeners:{
change: function(combobox,newValue, eOpts){
var combo2 = Ext.ComponentQuery.query('#combo2ItemId')[0];
var button = Ext.ComponentQuery.query('#buttonItemId')[0];
if(!Ext.isEmpty(newValue)) {
combo2.setHidden(false).setDisabled(false);
button.setHidden(true).setDisabled(true);
}
else {
combo2.setHidden(true).setDisabled(true);
button.setHidden(true).setDisabled(true);
}
}
在组合框2上:
listeners:{
change: function(combobox,newValue, eOpts){
var button = Ext.ComponentQuery.query('#buttonItemId')[0];
if(!Ext.isEmpty(newValue)) {
button.setHidden(false).setDisabled(false);
}
else {
button.setHidden(true).setDisabled(true);
}
}
我希望这会有所帮助!
【讨论】:
我猜你可能想在页面首次显示时禁用第二个组合和按钮。
然后您可以侦听每个组合的更改事件,并在您的处理程序代码中禁用\启用您需要根据传递给处理程序函数参数的值进行控制。
【讨论】: