我对 Jquery 很陌生,因此在这方面需要您的帮助。
我正在尝试将 jqGrid 与 JSON url 一起使用,但无法使用它。htm 页面不显示任何数据。
$(function () {
"use strict";
$('#list').jqGrid({
datatype: 'json',
url: 'json_url',
caption: 'Prospect Finder',
gridview: true,
height: "auto",
colNames: ['Partner','First Name', 'Last Name', 'Organization'],
colModel: [
{name: 'PARTNER', jsonmap: 'PARTNER' },
{name: 'NAME_FIRST',jsonmap: 'NAME_FIRST' },
{name: 'NAME_LAST', jsonmap: 'NAME_LAST' },
{name: 'NAME_ORG1', jsonmap: 'NAME_ORG1' }
],
jsonReader: {
repeatitems: false,
id: "PARTNER",
root: function (obj) {
return obj;
}
}
});
});
这是我的 JSON 数据
{"itab":[ { "PARTNER":"0061000220", "NAME_FIRST":"", "NAME_LAST":"", "NAME_ORG1":"GTA Central" }, { "PARTNER":"0061000221", "NAME_FIRST":"", "NAME_LAST":"", "NAME_ORG1":"GTA West" }, { "PARTNER":"0061000222", "NAME_FIRST":"", "NAME_LAST":"", "NAME_ORG1":"GTA East" }, { "PARTNER":"0041000141", "NAME_FIRST":"", "NAME_LAST":"", "NAME_ORG1":"Office Systems" } ]}
有人可以帮助我吗?
谢谢,DJ