【发布时间】:2011-03-04 12:36:09
【问题描述】:
我正在使用 ASP.NET 和 Jqgrid 3.7 进行测试,在 Firefox 中它可以正常工作,但在 IE 中它不会在网格中显示任何行。
来自网络服务的响应是
{"d":
{"__type":"jqGrid",
"total":"1",
"page":"1",
"records":"10",
"rows":[
{"id":"180","cell":["180","Cultura"]},
{"id":"61","cell":["61","Deporte"]},
{"id":"68","cell":["68","Deporte"]},
{"id":"5","cell":["5","Economía"]},
{"id":"67","cell":["67","Economía"]},
{"id":"76","cell":["76","Economía"]},
{"id":"178","cell":["178","Economía"]},
{"id":"4","cell":["4","Entrevista"]},
{"id":"66","cell":["66","Entrevista"]},
{"id":"78","cell":["78","Entrevista"]}
]
}
}
电话是
myGrid = $("#list").jqGrid({
url: 'ws/WsNoticias.asmx/jqObtenerTemas',
datatype: 'json',
mtype: 'GET',
loadBeforeSend: function(XMLHttpRequest) {
XMLHttpRequest.setRequestHeader("Content-Type", "application/json");
},
colNames: ['Id', 'Nombre'],
colModel: [
{name: 'Id', index: 'Id', width: 20, align: 'left', editable: false},
{name: 'Nombre', index: 'Nombre', width: 200, align: 'left', editable: false}
],
rowNum: 10,
rowList: [5, 10, 200],
sortname: 'Nombre',
sortorder: "asc",
pager: $("#listp"),
viewrecords: true,
caption: '',
width: 600,
height: 250,
jsonReader: {
root: "d.rows",
page: "d.page",
total: "d.total",
records: "d.records"
}
});
我看不出问题出在哪里...,对于 3.6 之前的版本和
thegrid.addJSONData(JSON.parse(jsondata.responseText).d);
它可以代替 jsonReader 工作。
【问题讨论】:
标签: asp.net json optimization jqgrid asmx