Hi,
I use render function to return a checkbox for a column. But I confused how to let the checkbox checked. I saw a demo about this. But I try it with my codes, have some problems.
Please have a look with my codes:
{ title: "PMM Done", width: 64,align: "center",dataIndx: "pmmdone",editable:false,
render: function (ui){
var rowData = ui.rowData, dataIndx = ui.dataIndx;
var val = rowData[dataIndx];
str = "";
if (val) {
str = "checked='checked'";
}
return "<input type='checkbox' " + str + "/>";
}
Then
obj.rowSelect = function (evt, ui) {
var rowIndx = ui.rowIndx;
var data = obj.dataModel.data;
var rowData = ui.rowData;
rowData["pmmdone"] = true;
//data[rowIndx]["pmmdone"] = true;
$("#grid_json").pqGrid("refreshCell", { rowIndx: rowIndx, dataIndx: "pmmdone"});
}
obj.rowUnSelect = function (evt, ui) {
var rowIndx = ui.rowIndx;
var rowData = ui.rowData;
rowData["pmmdone"] = false;
//data[rowIndx]["pmmdone"] = false;
$("#grid_json").pqGrid("refreshCell", { rowIndx: rowIndx, dataIndx: "pmmdone"});
}
When I test it, for example, I have four records in grid. I select the first one as checked, when I move the sidebar of bottom the next two rows' checkbox will be checked too.
And there is a error about rowUnSelect function:
" Cannot set property 'pmmdone' of undefined ".
So is there anything I missed or any mistake?
Thank you!