开发者

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},
      ...
   ]
...
})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜