【发布时间】:2017-08-09 11:33:49
【问题描述】:
我有以下格式的数据,绑定时我的jqGrid 中有空行。我的数据类型应该是什么,或者如何避免使用jsonReader,以便它默认处理它。
我的网格结构是,
$("#UserReportGrid").jqGrid({
datatype: 'local',
data: data,
colNames: colNames,
colModel: colNames,
localReader: {
repeatitems: true,
cell: "",
id: 0, root: "data",
},
rowNum: 10,
rowList: [10, 25, 50, 100],
pager: '#GridPager',
caption: "User Details",
height: 'auto',
sortname: 'SNo',
gridview: true
});
我试过了,
JSON.parse(data) resulted in exception
JSON.parse(JSON.stringify(data)) resulted in same no records are displayed
【问题讨论】:
-
只需从设置中删除 localReader 并确保您已在 colModel 中设置 key: true 以标识将充当 id 的列。数据应该是对象数组,你不需要 JSON.parse 它