$("#treegrid").jqGrid({
url: '${createLink(controller:"poa", action:"obtEstrucAreasDep")}',
datatype: 'json',
postData: {
gestion: function() { return ${gestion}; }
},
mtype: 'GET',
colNames: ["ID", "Nombre de Area", "Sigla", "Nivel", "Gener.HR", "Recep.HR", "Activo"],
colModel: [
{name:'id', index:'id', width:1, hidden:true, key:true},
{name:'area', index:'area', width:95, hidden:false, sortable:true},
{name:'sigla', index:'sigla', width:25, hidden:false, sortable:false, align:'center'},
{name:'nivel', index:'nivel', width:1, hidden:true, align:'center'},
{name:'genhr', index:'genhr', width:25, align:'center', editable: true, edittype:'checkbox', editoptions:{value:"True:False"}, formatter:"checkbox", formatoptions:{disabled:false}},
{name:'recep', index:'recep', width:25, align:'center', editable: true, edittype:'checkbox', editoptions:{value:"True:False"}, formatter:"checkbox", formatoptions:{disabled:false}},
{name:'activ', index:'activ', width:25, align:'center', editable: true, edittype:'checkbox', editoptions:{value:"True:False"}, formatter:"checkbox", formatoptions:{disabled:false}}
],
treeGridModel: 'adjacency',
height: 'auto',
width: '500', //360
treeGrid: true,
ExpandColumn: 'area',
ExpandColClick: true,
caption: '${titulo}'+' - GESTION '+'${gestion}',
onSelectRow: function(id){operRowJQGrid(id);}
});
Это было предоставлено JuanFer
jQuery(document).delegate('#treegrid .jqgrow td input', 'click', function(e){
var tr = $(e.target).closest('tr');
var rowid = tr[0].id;
var $myGrid = jQuery('#treegrid');
var i = $.jgrid.getCellIndex($(e.target).closest('td')[0]);
var cm = $myGrid.jqGrid('getGridParam', 'colModel');
var colName = cm[i].name;
var y = $(this).val();
var x = false
if(y=='false'){
$(this).val('true');
}else{
$(this).val('false');
}
x = $(this).val();
alert("check = "+x+", id = "+rowid+", col name = "+colName);
});