0
我正在开发一个网格,其中包含每个模块的许可证列表。JQGrid:dataEvents中的依赖性下拉列表更改
我想要的是在列中的组合框中进行更改时验证每2个事件。我使用的是1和0的激活/停用
第一种情况:如果我主动“写”,“修改”,“删除”或“打印”指的是自我选择“读”
第二种情况是相反的:如果禁用“阅读”将自动关闭“写”,“修改”,“删除”和“打印”
研究,我发现选项使用输入事件的函数:
{"name":"read",
"index":"read",
"width":48,
"resizable":false,
"editable":true,
"edittype":"select",
"editoptions":{
"value":"0:0;1:1",
"dataEvents":[{
"type":"change",
"fn":function(e){
if($(e.target).val() == '0')
{
// actions here...
}
}
}]
}
}
您可以更改其他列的元素...按行吗?
编辑
我的解决方案:
$('tr.jqgrow select[name*="read"]').live("change",function()
{
if($(this).val() === '0') $(this).closest('tr.jqgrow').find('select.editable').not(this).find('option:first-child').attr("selected", "selected");
});
$('tr.jqgrow select[name!="read"]').live("change",function()
{
$(this).closest('tr.jqgrow').find('select[name*="read"]').find('option:last-child').attr("selected", "selected");
});
感谢您的回复,我阅读了关于国家和州的主题...但我看到使用的代码非常广泛,也必须在每个字段中复制相同的功能,以便发布第二种情况。 我编辑我的问题与我自己的解决方案,适合我的需求。谢谢 – csotelo 2012-07-07 15:49:29
@csotelo:我写过你的话,解决方案会容易得多。重要的是,您只需手动更改'
@csotelo:所有内联编辑的选择都有一个id,它将像'3_read'一样构造,其中'3'是rowid,''read''是列中的'name'。或者,您可以搜索select by属性'name =“read”'。它将代码更具可读性并且独立于对'colModel'的小修改(如插入新列或使用'rownumbers:true'选项)。 – Oleg 2012-07-07 16:16:13