, , result.colNames result.colModel , , .
var cn = ['AccountID','ClientID'];
var cm = [
{editable:false,index:'AccountID',jsonmap:'AccountID',key:false,name:'AccountID',
resizable:true,search:false,sortable:true,width:300},
{editable:false,index:'ClientID',jsonmap:'ClientID',key:false,name:'ClientID',
resizable:true,search:false,sortable:true,width:300}];
var cd = '{total:1,page:1,records:1,rows:[{AccountID:1,ClientID:3}]}';
jQuery('#QueryGrid').jqGrid({
jsonReader: { repeatitems: false },
height: 'auto',
colNames: cn,
colModel: cm,
datastr: cd,
viewrecords: true
});
, , colModel, . shrinkToFit: true . ,
[{index:'AccountID',jsonmap:'AccountID',name:'AccountID',search:false,width:300},
{index:'ClientID',jsonmap:'ClientID',name:'ClientID',search:false,width:300}]
jsonReader: { repeatitems: false, cell:"" },
[{index:'AccountID',name:'AccountID',search:false,width:300},
{index:'ClientID',name:'ClientID',search:false,width:300}]
, result.colNames result.colModel JSON, , , jQuery.parseJSON. , result.colNames result.colModel.
var cnStr = '["AccountID","ClientID"]';
var cmStr = '[{"index":"AccountID","name":"AccountID","search":false,"width":300},{"index":"ClientID","name":"ClientID","search":false,"width":300}]';
var cd = '{total:1,page:1,records:1,rows:[{AccountID:1,ClientID:3}]}';
jQuery('
jsonReader: { repeatitems: false, cell:"" },
datatype: 'jsonstring',
height:'auto',
colNames: jQuery.parseJSON(cnStr),
colModel: jQuery.parseJSON(cmStr),
datastr: cd,
viewrecords: true
});
. key:true id jqGrid. . , jqGrid id = "1", id = "2" , id. , . , .