Got it all working (with my version of the checkbox) with this
function mychkclick(rowid, colid) {
val = $(“#list4”).getCell(rowid, colid);
newValue = “1”;
if (val == “1”) newValue = “2”;
$(“#list4”).setCell(rowid, colid, newValue);
val = $(“#list4”).getCell(rowid, colid);
}
jQuery.extend($.fn.fmatter , {
mycheckbox : function(cellvalue, options, rowobject) {
var checked = cellvalue == '2' ? “checked='checked' ” : “”;
var disabled = cellvalue == '0' ? “disabled='disabled' ” : “”;
rtn = “”;
return rtn;
}
});
jQuery.extend($.fn.fmatter.mycheckbox , {
unformat : function(cellvalue, options, cellobject) {
var checked = $(cellobject).html().indexOf(“checked”,0) != -1 ? “2” : “1”;
return checked;
}
});
var mydata = [
{id:”1″,name:”test”,checkbox:1},
{id:”2″,name:”test2″,checkbox:0},
];
jQuery(“#list4”).jqGrid({
datatype: “local”,
data: mydata,
height: 250,
colNames:['id','name','checkbox'],
colModel:[
{name:'id',index:'id', width:60, sorttype:”int”},
{name:'name',index:'name', width:100},
{name:'checkbox',index:'checkbox', width:80, align:”right”,sorttype:”float”,editable:true,edittype:'select',formatter:'mycheckbox',formatoptions:{disabled:false}, },
],
multiselect: true,
caption: “Demo”
});