JQGrid - disable checkbox based on value
I would like to disable a checkbox in JQGrid where multiselect: true is set.
It was touched on here:
Disabling checkbox in “multiselect:true” mode for a specific row in jqgrid
but I'm not sure how to implement this solution since I am new to jqgrid.
I'm 开发者_C百科looking to do something like:
if (amount > 50) {
disable checkbox
}
best way is to write custom formatter : 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
}
and when constructing jqgrid :
jQuery("#grid_id").jqGrid({
...
   colModel: [ 
      ... 
      {name:'checkbox', index:'checkbox', width:60, align:"center", formatter:checkBoxFormatter},
      ...
   ]
...
})
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论