easyui 选择框(ComboBox)选中时触发事件
来源:互联网 发布:彩票预测app源码 编辑:程序博客网 时间:2024/04/28 00:31
easyui 选择框默认屏蔽了onChange()事件,在使用时可以使用自带的onSelect事件
//选择后触发事件,
$(function(){
$("#groupCombobox").combobox({
onSelect:function(record){
var curValue=$('#groupCombobox').combobox('getValue');
if(curValue==1){
$("[name='userGroupRight']").attr("checked",'true');
}else if(curValue==2){
$("[name='userGroupRight']").removeAttr("checked");
$("[name='userGroupRight']").each(function(){
if($(this).val()==1){
$(this).attr("checked",'true');
}
if($(this).val()==3){
$(this).attr("checked",'true');
}
if($(this).val()==5){
$(this).attr("checked",'true');
}
})
}else{
$("[name='userGroupRight']").removeAttr("checked");
}
}
});
});
注:一般在页面弹出新增窗口时,有下拉选择框,此激活代码应与dialog放在一块才能激活。
<div id="groupForm" class="easyui-dialog" style="width:425px;height:350px;" closed="true" buttons="#dlg-buttons" data-options="modal:true">
<div class="easyui-panel" style="width:410px">
<div style="padding:10px 60px 20px 60px">
<form id="userGroupForm" method="post">
<table cellpadding="5">
<tr>
<td>名称:</td>
<td><input class="easyui-validatebox textbox" type="text" name="name" id="name" data-options="required:true"></input></td>
</tr>
<tr>
<td>说明:</td>
<td><input class="easyui-validatebox textbox" type="text" id="description" name="description"></input></td>
</tr>
<tr>
<td>用户权限:</td>
<td>
<select id="groupCombobox" name="groupCombobox" class="easyui-combobox" style="width:200px;" data-options="required:true">
<option value="1" selected="selected">系统管理员</option>
<option value="2">普通用户</option>
<option value="3">自定义权限</option>
</select>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="checkbox" value="1" checked name="userGroupRight">查询本人导入的检查记录</input><br>
<input type="checkbox" value="2" checked name="userGroupRight">查询所有检查记录</input><br>
<input type="checkbox" value="3" checked name="userGroupRight">查询本人的操作日志</input><br>
<input type="checkbox" value="4" checked name="userGroupRight">查询所有操作日志</input><br>
<input type="checkbox" value="5" checked name="userGroupRight">修改用户密码</input><br>
<input type="checkbox" value="6" checked name="userGroupRight">管理用户</input>
</td>
</tr>
</table>
</form>
<div style="text-align:center;padding:5px">
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="userGroupsubmitForm()">提交</a>
<a href="javascript:void(0)" class="easyui-linkbutton" onclick="userGroupclearForm()">取消</a>
</div>
</div>
</div>
<script>
function userGroupsubmitForm(){
$('#userGroupForm').form('submit', {
url:'groupController.do?addgroup',
onSubmit: function(){
return $(this).form('validate');
}
});
/* $('#groupForm').dialog('close');
$('#userTreegrid').treegrid('reload'); */
}
function userGroupclearForm(){
$('#groupForm').dialog('close');
}
//选择后触发事件
$(function(){
$("#groupCombobox").combobox({
onSelect:function(record){
var curValue=$('#groupCombobox').combobox('getValue');
if(curValue==1){
$("[name='userGroupRight']").attr("checked",'true');
}else if(curValue==2){
$("[name='userGroupRight']").removeAttr("checked");
$("[name='userGroupRight']").each(function(){
if($(this).val()==1){
$(this).attr("checked",'true');
}
if($(this).val()==3){
$(this).attr("checked",'true');
}
if($(this).val()==5){
$(this).attr("checked",'true');
}
})
}else{
$("[name='userGroupRight']").removeAttr("checked");
}
}
});
});
</script>
</div>
- easyui 选择框(ComboBox)选中时触发事件
- easyui 复选框选中触发事件
- 触发easyui combobox 中 onchange 事件
- easyui combobox 中 onchange 事件的触发
- easyui combobox 复选框选择
- easyui combobox设置选中
- easyui combobox设置选中
- ExtJS4 ComboBox选择第一个选项时不能触发select事件的处理
- Delphi Combobox自动选择项及触发onchange事件
- easyui-combobox下拉框异步级联选择
- EasyUI入门5 给combobox增加选择事件
- easyui combobox 选中某个默认值
- [转]easyui combobox设置选中
- Easyui combobox onChange事件
- easyui-combobox选中下拉框无法显示值
- easyUI datagrid触发事件
- ComboBox绑定DataTable数据,用户选中项后触发事件异常。
- ComboBox绑定DataTable数据,用户选中项后触发事件异常,之二!
- 谈谈RIP协议中的计时器
- “下载”中“载”的发音应该读几声——计算机学生视角
- c3p0连接池事务不能回滚的问题
- 《深入理解Android内核设计思想》已陆续在全国各大书店及网上书店上市,感谢大家一直以来的支持~~
- 理解php反射机制-1
- easyui 选择框(ComboBox)选中时触发事件
- 彻底禁用resource manager
- 【我所认知的BIOS】—> uEFI AHCI Driver(5) — 第一个protocol终于要开始安装了
- hibernate 中使用oracle数据库 与java Date数据类型 只显示到天 不显示时分秒的问题
- Hdu 1042 N! (高精度数)
- 分组,group,泳道 JBPM
- matlab求0-1封闭区域围成的面积
- 安装和使用安卓iGO遇到的问题及解决方法
- oracle 11g rac 搭建