不知道是否我錯過了一個選項,但我無法使用以下代碼對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