Asp.net jqGrid使用mtype post json加载aspx webservice未加载网格

Asp.net jqGrid使用mtype post json加载aspx webservice未加载网格,asp.net,json,web-services,jqgrid,Asp.net,Json,Web Services,Jqgrid,几天来,我一直在努力让它发挥作用 奇怪的是,我已经通过各种试验使它发挥了一定的作用,但现在它根本没有加载 以下是我的设置: $("#table-Select").jqGrid({ url: 'SelectionListService.asmx/GetList', mtype: 'POST', datatype: 'json',

几天来,我一直在努力让它发挥作用

奇怪的是,我已经通过各种试验使它发挥了一定的作用,但现在它根本没有加载

以下是我的设置:

$("#table-Select").jqGrid({
                        url: 'SelectionListService.asmx/GetList',
                        mtype: 'POST',
                        datatype: 'json',
                        ajaxGridOptions: { contentType: 'application/json; charset=utf-8' }, 
                        postData: { SelectionType:  'Project' },
                        colNames: ['id', 'Title', 'DocumentID'],
                        colModel: [
                                    { name: 'id', index: 'id', width: 20,hidden: false },
                                    { name: 'Title', index: 'Title' ,width: 220,hidden:false},
                                    { name: 'DocumentID', index: 'DocumentID',width: 220, hidden: false}
                                    ],
                        hidegird: false,
                        autowidth: true,
                        //height: 'auto',
                        rowNum: 0,
                        rowList: [10, 20, 30],
                        pager: jQuery('#table-SelectPager'),
                        sortname: 'Title',
                        viewrecords: true,
                        loadonce: true,
                        sortorder: "desc",
                        caption: "Select Project",
                        //fixes Invalid JSON Primitive error
                        serializeGridData: function (postData) { 
                                if (postData.searchField === undefined) postData.searchField = null; 
                                if (postData.searchString === undefined) postData.searchString = null; 
                                if (postData.searchOper === undefined) postData.searchOper = null; 
                                //if (postData.filters === undefined) postData.filters = null; 
                                return JSON.stringify(postData);
                            }, 
                         jsonReader: {
                            root: "rows",
                            page: "page",
                            total: "total",
                            records: "records"
                            }

                        }).navGrid('#table-SelectPager', { edit: false, add: false, del: false });
以下是来自WebService调用的JSON数据:

{"d":{"__type":"NCR.SelectionListService+JQGrid","page":1,"total":4,"records":4,"rows":[{"id":"1","DocumentID":"pgmprj://aecomme/newdohaportproject/envcomp","Title":"NDPP-Environmental Compliance Monitoring"},{"id":"2","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-portbasinandinnerbreakwatersconstruction","Title":"NDPP-Port Basin and Inner Breakwaters Construction"},{"id":"3","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-programmanagement","Title":"NDPP-Program Management"},{"id":"4","DocumentID":"pgmprj://aecomme/newdohaportproject/ndpp-supplementarysiteinvestigation","Title":"NDPP-Supplementary Site Investigation"}]}}
我知道这一定是我遗漏了一些简单的东西——但在我看了所有的例子之后——我不知道我遗漏了什么


如果您有任何想法,我们将不胜感激。

您应该将
jsonReader
选项修改为以下内容:

jsonReader: {
    root: "d.rows",
    page: "d.page",
    total: "d.total",
    records: "d.records",
    repeatitems: false
}

瞧。

谢谢奥列格的帮助-我刚想知道那件事,你也打败了我-再次谢谢。奇怪的是,当我单击排序函数时,我的所有行都消失了,即使根据$(“#table Select”).jqGrid('getGridParam',records');更新,在排序时发现问题,出于某种原因,我在某些人的示例中看到rowNum:0,因此我尝试在我的示例中设置它,它加载第一个集合查找,但这样做会导致排序清除网格上的记录。喜欢jqGrid-谢谢Oleg@我刚刚发现了同样的问题。您还应该在
id
列中包含
sorttype:'int'
。请参阅修改后的演示。如果问题解决了,你可以找到答案。