[英]JqGrid Checkbox enable/disable via function
I wanna be able to disable/enable a jqGrid checkbox based on a bool value passed back from a function. 我想基于从函数传回的布尔值来禁用/启用jqGrid复选框。 How would I do this? 我该怎么做?
snippet of code below 下面的代码片段
colModel: [
{ name: 'IsSystemAdmin', index: 'IsSystemAdmin', width: 50, align: "center",
formatter: "checkbox",
formatoptions: { disabled: isSystemAdmin}, editable: true }
],
* Please note where I call the function: formatoptions: { disabled: isSystemAdmin}, editable: true } * * 请注意我在哪里调用该函数:formatoptions:{已禁用:isSystemAdmin},可编辑:true} *
var isSystemAdmin = new function(){
//do something and return a bool value
}
or 要么
function isSystemAdmin(){
//do something and return a bool value
}
Resolved apparently the code I have above does in fact work. 显然,我上面的代码确实可以解决。 Only Change : 唯一的变化:
formatoptions: { disabled: isSystemAdmin()} formatoptions:{已禁用:isSystemAdmin()}
instead of 代替
formatoptions: { disabled: isSystemAdmin} formatoptions:{已禁用:isSystemAdmin}
Use the .jqGrid('setSelection' method 使用.jqGrid('setSelection'方法
function isSystemAdmin() {
jQuery("#list13").jqGrid('setSelection',"13");
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.