我使用ASP.NET和Jqgrid 3.7測試,在Firefox中它工作正常,但在IE中它不顯示網格中的任何行。Jqgrid 3.7不顯示在Internet Explorer中的行
來自web服務的響應
{"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它的工作原理。
謝謝你,它像一個魅力。關鍵是: ajaxGridOptions:{contentType:'application/json; charset = utf-8'} – 2010-06-18 13:20:47