【发布时间】:2014-07-23 13:12:10
【问题描述】:
在这个例子中我对本地数据排序有一些问题。排序不起作用,我不知道它的原因。你能解释一下我的代码中的问题吗?
<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
【问题讨论】:
-
“不起作用”是什么意思?能具体一点吗?
-
“不起作用”意味着我无法使用 jqgrid 排序对网格中的值进行排序。您可以单击演示link 中的“客户端”列的标题,并看到排序不会改变元素的顺序。
-
而排序就是jqgrid本地排序。
标签: jqgrid