jqgrid 显示黑色表,即使它正确显示了记录数,我正在使用返回 json 字符串的 web 服务,我可以看到它从 ajax 调用返回的数据,但它没有显示在表中,我从 webservice 获得的 json 数据是:
Json:
[{"profile_id":"413a75c9-03b4-4660-841b-2d213a2e2b95", "id":"313","first_name":"abc", "email":"abc@gmail.com"} , {"profile_id":"498fa726-0a34-4bbd-baab-6b4f2eb13bcf" , "id":"308" , "first_name":"xyz" , "email":"xyz@gmail.com"}]
$.ajax({
url:'rest/WebService/Getdata',
dataType:'json',
success: function (data_response) {
jqgrid(JSON.stringify(data_response));
},
error: function (error) {
alert("error");
alert(JSON.stringify(error));
}
});
function jqgrid(jsondata){
$("#list3").jqGrid({
datatype:"jsonstring",
datastr:jsondata,
colNames:['Profile_id','id', 'Name', 'Email'],
colModel:[
{name:'Profile_id',index:'profile_id', width:500},
{name:'id',index:'id', width:250},
{name:'Name',index:'first_name', width:300},
{name:'Email',index:'email', width:240}
],
jsonReader: {
id: "1",
cell: "",
root: "root",
page: "page",
total: "total",
records: "records",
repeatitems: false
},
emptyrecords: "Nothing to display",
rowNum:10,
rowList:[10,20,30],
pager: $('#pager3'),
viewrecords: true,
sortorder: "desc",
caption: "Data table"
});
}