Ajax数据结果到jqgrid显示

Ajax数据结果到jqgrid显示,jqgrid,jqgrid-php,Jqgrid,Jqgrid Php,我有一个AJAX调用的结果,我想把它传递给jqgrid。格式与正常的jqgrid调用完全相同。我不知道为什么它不起作用,非常感谢任何帮助 {“page”:null,“total”:2,“records”:“16”,“rows”:[{“id”:“9910003”,“cell”:[“9910003”,“DEMO3”,“Test3”,“Sat,Sun”,“08:00:00”,“17:00:00”,“17”,“17”,“0”]},{“id”:“9910004”,“DEMO4”,“Test4”,“Test

我有一个AJAX调用的结果,我想把它传递给jqgrid。格式与正常的jqgrid调用完全相同。我不知道为什么它不起作用,非常感谢任何帮助

{“page”:null,“total”:2,“records”:“16”,“rows”:[{“id”:“9910003”,“cell”:[“9910003”,“DEMO3”,“Test3”,“Sat,Sun”,“08:00:00”,“17:00:00”,“17”,“17”,“0”]},{“id”:“9910004”,“DEMO4”,“Test4”,“Test4”,“Sat,Sun”,“08:00:00”,“17:00”,“19”,“0”},{“id”:“9910005”,“cell”,“9910005”,“Sat,Sun”,“08:00:00”,“17:00”,“10006”,“cell”::[“9910006”,“DEMO6”,“Test6”,“Sat,Sun”,“08:00:00”,“17:00:00”,“17”,“0”],{“id:“9910007”,“cell:[“9910007”,“DEMO7”,“Test7”,“Sat,Sun”,“08:00:00”,“17:00:00”,“14”,“0”]},{“id:“9910008”,“cell:[“9910008”,“DEMO8”,“Test8”,“Sat,Sun”,“21:00”,“06:00”,“19”,“0”},{“id:“9910009”,“cell:“9999”,“DEMO9”,“Test9”,“Sun”,“14:00”,“14:00”},{“id”:“9910010”,“cell”:[“9910010”,“DEMO10”,“Test10”,“Sat,Sun”,“21:00:00”,“06:00:00”,“14”,“0”]},{“id”:“9910011”,“cell”:[“9910011”,“DEMO11”,“Test11”,“Sat,Sun”,“21:00:00”,“06:00”,“06:00:00”,“14”,“0”]},{“id”:“9910012”,“Test12”,“Sat,Sun”,“21:00:00”,“06:00”,“17”,“0”],{“id”:“9910013”,“Test13”,“Test13”,“DEMO13”,“13”,“21:00:00”,“06:00:00”,“16”,“0”]},{“id”:“9910014”,“cell”:[“9910014”,“DEMO14”,“Test14”,“Sat,Sun”,“21:00:00”,“06:00:00”,“14”,“0”},{“id”:“9910015”,“DEMO15”,“Test15”,“Sat,Sun”,“21:00:00”,“06:00”,“14”,“0”},{“id”:“9910016”,“cell”:“9910016”,“Sat,Sun”,“21:00”,“21:00”,“Test15”,“Test15”,“Test15”,“Test15”,“Test15”,“21:00”,“21:00”,“06:00”,“0”}

以下是我的完整代码:

function report_grid() {
$.ajax({
    type: "POST",
    url: "filter_option.php?action=filter",
    data: $('#form1').serialize(),
    success: function(rdata) {

jQuery("#report-grid").jqGrid({
    data: rdata,
    datatype: "local",
    colNames:['Emp ID','firstName', 'surName', 'restDay','shift_In','shift_Out','late','undertime'],
    colModel:[
        {name:'emp_id',index:'emp_id', width:55},
        {name:'firstname',index:'firstname', width:90},
        {name:'surname',index:'surname', width:100},
        {name:'restday',index:'restday', width:80, align:"right"},
        {name:'shift_in',index:'shift_in', width:80, align:"right"},
        {name:'shift_out',index:'shift_out', width:80,align:"right"},
        {name:'late',index:'late', width:150, sortable:false},
        {name:'ut',index:'ut', width:150, sortable:false},
    ],
    height: 'auto',
    width: 'auto',
    rowNum:10,
    rowList:[10,15,20,30,50],
    pager: '#report-pager',
    sortname: 'emp_id',
    viewrecords: true,
    sortorder: "desc",
    caption:"Timesheet Summary"
});
jQuery("#report-grid").jqGrid('navGrid','#report-pager',{edit:false,add:false,del:false});

        }
    })
}
我在下面试过,但没有成功,我想我错过了一些东西

data:rdata.rows
datatype:"local" // shows only the id but with correct number of records

data:rdata.rows
datatype: "json" // shows nothing at all.

现在明白了,我的json格式不正确,我应该参考演示页面中的数据数组