我想禁用JQGrid中设置了multiselect: true
的复选框。
这里有人感动:
Disabling checkbox in “multiselect:true” mode for a specific row in jqgrid
但是我不确定如何实现这个解决方案,因为我是jqgrid的新手。
我正在做类似的事情:
if (amount > 50) {
disable checkbox
}
答案 0 :(得分:1)
最好的方法是编写自定义格式化程序:http://www.trirand.com/jqgridwiki/doku.php?id=wiki:custom_formatter
function checkBoxFormatter(cellvalue, options, rowObject)
{
if (rowObject. amount > 50) {
//return disabled checkbox string
}else{
//return enabled checkbox string
}
return new_format_value
}
并且在构造jqgrid时:
jQuery("#grid_id").jqGrid({
...
colModel: [
...
{name:'checkbox', index:'checkbox', width:60, align:"center", formatter:checkBoxFormatter},
...
]
...
})