0

スタック オーバーフロー愛好家の皆さん。viewData リポジトリに入れた JSON データから入力したい jqGrid グリッドがあります。どうやってやるの?

これまでのところ、私が持っているのはこれだけです...更新: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) { }
    })
4

1 に答える 1

1

このようにしてみてください:

datatype: 'json',
datastr: @Html.Raw(Json.Encode(ViewData["ResultData"]))
于 2012-12-26T13:44:27.917 に答える