嘿,Stack Overflow 爱好者。我有一个 jqGrid 网格,我想从我放入 viewData 存储库的 JSON 数据中填充它。我怎样才能做到这一点?
到目前为止,我所拥有的就是这个......更新:我现在正在尝试使用控制器方法而不是通过 viewData 传递数据
$("#results").jqGrid({
shrinkToFit: false,
autowidth: false,
width: 800,
datatype: 'jsonsstring',
url:'<%=Url.Action("getGrid", "Log", new { physSearch = Model})%>',
//datastr: $.jgrid.htmlEncode('@ViewData["ResultData"]'),
mtype: 'POST',
colNames:
[
'Sent Time',
'Recipient',
'EPCD ID',
'Address',
'Channel',
'Sent Status',
'Document ID',
'MRN',
'Patient Name',
'Pages',
'Message Log ID',
'Orginial Message Log ID',
'Message ID',
'Message Type',
'Sender',
'Comments'
],
colModel:
[
{ name: 'Sent_Time', width: 115 },
{ name: 'Recipient', width: 115 },
{ name: 'EPCD_ID', width: 115 },
{ name: 'Address', width: 115 },
{ name: 'Channel', width: 115 },
{ name: 'Sent_Status', width: 115 },
{ name: 'Document_ID', width: 115 },
{ name: 'MRN', width: 115 },
{ name: 'Patient_Name', width: 115 },
{ name: 'Pages', width: 115 },
{ name: 'Message_Log_ID', width: 115 },
{ name: 'Orginial_Message_Log_ID', width: 115 },
{ name: 'Message_ID', width: 115 },
{ name: 'Message_Type', width: 115 },
{ name: 'Sender', width: 115 },
{ name: 'Comments', width: 115 }
],
rowNum: 10,
rowList: [5, 10, 20, 50],
sortname: 'Id',
sortorder: "desc",
loadui: 'block',
loadtext: 'Results Grid',viewrecords: true,
imgpath: '/Content/themes/UPMC-theme/images',
caption: 'Patient Return Result',
ondblClickRow: function (id) { }
})