Hi tony,
Are you sure this isn't a bug?
With the following configuration:
|
|
jQuery("#mygrid").jqGrid({<br /> datatype: "json",<br /> colNames:['#','Name'],<br /> colModel:[<br /> {name:'id',index:'id', width:60, key:true},<br /> {name:'name',index:'name', width:120}<br /> ],<br /> subGrid: false,<br /> ...<br /> |
If subGrid is false, the 'id' column will be the key column.
However, if subGrid is true, the 'name' column will become the key column, which is not correct is it?
Modifying the code in grid.base.js (line 1147ff) with a decrement if subGrid is set resolves this:
|
|
for (var i=0; i<ts.p.colModel.length;i++) {<br /> if (ts.p.colModel<i>.key===true) {<br /> if (ts.p.subGrid) i--;<br /> ts.p.keyIndex = i;<br /> break;<br /> }<br /> }<br /> </i> |