在此示例中,我在本地数据排序方面遇到一些问题。排序不起作用,我不知道原因。你能解释一下我的代码中的问题吗?
<table id="list" ></table>
<div id="pager"></div>
<script type="text/javascript">
var myData = [
{ id: "1", cell: ["1", "test"] },
{ id: "2", cell: ["2", "test2"] },
{ id: "3", cell: ["3", "test3"] },
{ id: "4", cell: ["4", "test4"] }
];
jQuery("#list").jqGrid({
data: myData,
datatype: "local",
colNames: ['MyId','Client'],
colModel: [{ name: 'MyId', index: 'MyId', width: 100, align: 'left' , sortable: true},
{ name: 'Client', index: 'Client', width: 100, align: 'left', sortable: true }],
rowNum:10,
rowList:[10,20,30,100],
pager: '#pager',
sortname: 'Id',
localReader: {repeatitems: true},
viewrecords: true,
sortable: true,
sortorder: "asc",
caption: "Tests",
loadonce: true
});
jQuery("#list").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false });
</script>
附:在此演示中,排序也不适用于本地数据。http://www.ok-soft-gmbh.com/jqGrid/LocalReader.htm http://www.ok-soft-gmbh.com/jqGrid/LocalReader.htm