プロジェクトにjqGridを利用しています。グリッドは問題なく初期化されますが、JSON を入力しようとすると、うまくいきません。
HTML:
<table id="search-results"></table>
<div id="search-pagination"></div>
JS:
//init jqGrid, no problems here
var grid = jQuery('#search-results');
grid.jqGrid({
dataType: 'local',
jsonReader: {
cell: '', //this allows us to ignore the 'cell' property in the response json
id: 0 //this defines the index in the row that contains the unique id for the row
},
colNames:['OrderID', 'First Name', 'Last Name', 'Maiden Name', 'Insco Code', 'Origin', 'Status', 'Appointment', 'Agent Name', 'Hprof/Interviewer', 'Case Date', 'Hprof/Interviewer', 'Street Address', 'Province', 'City', 'Branch #', 'Policy #'],
colModel:[
{ name: 'Order.ORDERID', index: 'Order.ORDERID', sortable: true, width: '100px', frozen: true},
{ name: 'Applicant.LASTNAME', index: 'Applicant.LASTNAME', sortable: true, width: '100px', frozen: false},
{ name: 'Applicant.FIRSTNAME', index: 'Applicant.FIRSTNAME', sortable: true, width: '100px', frozen: false},
{ name: 'ApplicantMaidenName', index: 'ApplicantMaidenName', sortable: true, width: '100px', frozen: false},
{ name: 'InsCoCode.DESCRIPTION', index: 'InsCoCode.DESCRIPTION', sortable: true, width: '100px', frozen: false},
{ name: 'Order.ORIGIN', index: 'Order.ORIGIN', sortable: true, width: '100px', frozen: false},
{ name: 'MedCase.STATUS', index: 'MedCase.STATUS', sortable: true, width: '100px', frozen: false},
{ name: 'MedCase.PERFORMEDDATE', index: 'MedCase.PERFORMEDDATE', sortable: true, width: '100px', frozen: false},
{ name: 'AgentFullName', index: 'AgentFullName', sortable: true, width: '100px', frozen: false},
{ name: 'ExaminerFullName', index: 'ExaminerFullName', sortable: true, width: '100px', frozen: false},
{ name: 'MedCase.DATEORDERED', index: 'MedCase.DATEORDERED', sortable: true, width: '100px', frozen: false},
{ name: 'Exam.FOLLOWUPDATE', index: 'Exam.FOLLOWUPDATE', sortable: true, width: '100px', frozen: false},
{ name: 'ApplicantStreetAddress', index: 'ApplicantStreetAddress', sortable: true, width: '100px', frozen: false},
{ name: 'Applicant.ADDR1_STATE', index: 'Applicant.ADDR1_STATE', sortable: true, width: '100px', frozen: false},
{ name: 'Applicant.ADDR1_CITY', index: 'Applicant.ADDR1_CITY', sortable: true, width: '100px', frozen: false},
{ name: 'MedCase.MEDICALCOMPANYID', index: 'MedCase.MEDICALCOMPANYID', sortable: true, width: '100px', frozen: false},
{ name: 'Order.POLICYNUMBER', index: 'Order.POLICYNUMBER', sortable: true, width: '100px', frozen: false}
],
rowNum:20,
rowList:[10,20,30],
pager: '#search-pagination',
sortname: 'Order.ORDERID',
viewrecords: true,
sortorder: "desc",
mtype: 'POST',
autowidth: true,
shrinkToFit: false
});
grid.jqGrid('setFrozenColumns');
//trying to load grid now, no luck
grid.jqGrid('setGridParam', {
url: '/fasttrack/search?' + form.serialize(),
dataType: 'json'
}).trigger('reloadGrid');
JSON レスポンス:
{
"page": 1,
"total": 5,
"records": 100,
"rows": [
[
0,
"two0",
"three0",
"four0",
"five0",
"six0",
"seven0",
"eight0",
"nine0",
"ten0",
"eleven0",
"twelve0",
"thirteen0"
],
[
1,
"two1",
"three1",
"four1",
"five1",
"six1",
"seven1",
"eight1",
"nine1",
"ten1",
"eleven1",
"twelve1",
"thirteen1"
],
[
2,
"two2",
"three2",
"four2",
"five2",
"six2",
"seven2",
"eight2",
"nine2",
"ten2",
"eleven2",
"twelve2",
"thirteen2"
],
[
3,
"two3",
"three3",
"four3",
"five3",
"six3",
"seven3",
"eight3",
"nine3",
"ten3",
"eleven3",
"twelve3",
"thirteen3"
],
[
4,
"two4",
"three4",
"four4",
"five4",
"six4",
"seven4",
"eight4",
"nine4",
"ten4",
"eleven4",
"twelve4",
"thirteen4"
],
[
5,
"two5",
"three5",
"four5",
"five5",
"six5",
"seven5",
"eight5",
"nine5",
"ten5",
"eleven5",
"twelve5",
"thirteen5"
]
]
}
グリッドに新しいデータが取り込まれません。私は何を間違っていますか?私はドキュメントを読み、いくつかの異なる例を見てきました。