不知道是否我错过了一个选项,但我无法使用以下代码对jqGrid进行排序。我的网格刚好有一列,我想使排序:jqGrid:排序不工作,在colmodel中指定索引,排序,排序类型
$('#jqgrid').jqGrid({
url: contextPath + '/js/jqgrid-data.json',
datatype: 'json',
colNames: ['Destination Name'],
colModel: [
{ name: 'DestName',
sortable: true,
sorttype: 'text',
index: 'DestName'
}
],
sortname: 'DestName',
sortorder: 'asc',
jsonReader: { repeatitems: false },
height: 'auto',
width: 600,
onSelectRow: function(id){
alert('Selected row ID ' + id);
}
});
的数据从服务器看起来是这样的:
{
"total": 1,
"page": 1,
"records": 10,
"rows": [
{
"id": "1",
"DestName": "Administration Office"
},
{
"id": "2",
"DestName": "Business Office"
}
....
}
想法?
如果您想在未来收到有关您的问题的答案,您应该开始[“接受”](http://meta.stackexchange.com/a/5235/147495)答案。此外,您有权每天投票30次有用的答案或问题**(请参阅[此处](http://meta.stackexchange.com/a/5213/147495))。投票不仅提供其他声望点。它可以帮助其他访问者找到有用的答案。所以如果你想帮助别人,请使用你的权利并使用投票。我建议您阅读(重新阅读)FAQ的[部分](http://stackoverflow.com/faq#howtoask)。 – Oleg