I am using jqGrid for converting Json object into regular HTML table. From server I get object and everything is good except one thing. I have added one column that is actually checkbox column. In value attribute of each checkbox input I've put ID that later I am passing back to server if checkbox is checked.
$("#membersGrid").jqGrid({
url: '/Member/GetAllMembers',
mtype: "GET",
styleUI: 'Bootstrap',
datatype: "json",
colModel: [
{ label: 'Full Name', name: 'fullName', width: 150 },
{
label: 'Select', editable: true, name: 'id',
edittype: 'checkbox', editoptions: { value: "true:false", defaultValue: "false" },
formatter: "checkbox", formatoptions: { disabled: false }, width: 45
}
],
viewrecords: true,
height: 250,
width: 640,
rowNum: -1,
ajaxSubgridOptions: { async: false },
});
When generating checkbox column for value I am defining true or false and with defaultValue I wanted to state that false(unchecked) is default value for each and every generated cell with checkbox.
But instead I am getting randomly checked check-boxes:
When I inspect element in Chrome, unchecked type is auto generated in this way:
<td role="gridcell" style="" title="" aria-describedby="membersGrid_id">
<input type="checkbox" value="400" offval="no">
</td>
And checked type like this:
<td role="gridcell" style="" title="" aria-describedby="membersGrid_id">
<input type="checkbox" checked="checked" value="399" offval="no">
</td>
Is there some other way to tell jqGrid to avoid checking checkboxes reather that using defaultValue
attribute? Or I am doing something wrongly?