我試圖綁定JSON格式的數據時,我試圖相同的代碼在.aspx頁面其不拋出任何錯誤,但中的jqGrid CSHTML一頁一頁的投擲錯誤的jqGrid不是function.i cannt能看到grid.My代碼的設計是這樣的`在mvc4 CSHTML頁工作,但在aspx頁面工作正常時jqgrid`不是一個函數錯誤
<script language="javascript" type="text/javascript">
$(document).ready(function() {
var gridimgpath = 'themes/basic/images';
$("#projectList").jqGrid({
datatype: "json",
height: 150,
colNames: ['WorkSpaceName', 'Id'],
colModel: [
{ name: 'Id', index: 'Id', width: 600 },
{ name: 'WorkSpaceName', index: 'WorkSpaceName', width: 600 },
],
imgpath: gridimgpath,
multiselect: true,
ignoreCase: true,
hidegrid: false,
caption: "WorkSpace Name",
pager: '#gridpager',
rowNum: 10,
viewrecords: true,
rowList: [10, 20, 30, 40]
});
$.ajax({
url: 'OauthVerifierNew',
type: 'GET',
dataType: "json",
contentType: 'application/json; charset=utf-8',
data: {},
beforeSend: function() {
alert("hello")
},
success: function (response) {
$("#projectList").setGridParam({ data: response }).trigger("reloadGrid");
},
error: function (error) {
alert(error);
}
});
$("#projectList").jqGrid('filterToolbar', { stringResult: true, searchOnEnter: false, defaultSearch: "cn" });
});
我更換了腳本文件,它的工作F9 – user2322397 2013-05-14 13:51:47
你把jqGrid的依賴已經aspx頁面後? – Olrac 2013-05-16 09:13:05