我有从 json 服务读取数据的 jqgrid
$('#list').jqGrid({
url: 'jsonservice',
datatype: 'json',
mtype: 'GET',
colNames: ['Id', 'Name', 'Street', 'City'],
colModel: [
{ name: 'Id', index: 'Id', width: 55, align: 'center', width: '25' }
{ name: 'Name', index: 'Name', width: 120 },
{ name: 'Street', index: 'Street', width: 90 },
{ name: 'City', index: 'City', width: 50 },
]
});
json 服务返回这样的数据
{"page":1,
"total":37,
"records":722,
"rows":
[
{"id":1,"cell":[1, "Sample name 1","Sample Street 2","Sample City 3"]},
{"id":2,"cell":[2, "Sample name 2","Sample Street 2","Sample City 3"]}
]
}
如何在不更改json数据顺序的情况下将显示列的顺序更改为例如名称、城市、街道、ID?