我收到JavaScript
错误:
未捕获TypeError:jQuery(...)。getGridParam不是函数
我的JQGrid
申请表中的剃刀视图中有一个mvc4
在提交表单时,我只想要JQGrid
脚本代码
(function ($) {
$('#JQGrid1').jqGrid({
url: '/ExamForm/GetSubjects/',
datatype: "json",
contentType: "application/json; charset-utf-8",
mtype: 'GET',
width: 950,
height: 150,
colNames:new Array("#",'SubjectID', 'SubjectName', 'GroupName', ' SubjectCode'),
colModel:new Array(
{ name: 'Flag1', index: 'Flag1', edittype: 'checkbox', formatter: 'checkbox', width: 15, editable: true, editoptions: { value: "True:False" }, formatoptions: { disabled: false } },
{ name: 'SubjectID', index: 'SubjectID', width: 20, key: true },
{ name: 'SubjectName', index: 'SubjectName', width: 60 },
{
name: 'GroupName', index: 'GroupName', width: 60, editable: true,
editrules: {
required: true,
edithidden: true
},
hidden: true
},
{ name: 'SubjectUniversityCode', index: 'SubjectUniversityCode', width: 20 }
),
rowNum: 100,
//pager: "#JQGrid1_pager",
loadonce: true,
grouping: true,
groupingView: {
groupField: ['GroupName']
},
multiselect: true,
pager: '#JQGrid1_pager',
});
jQuery("#JQGrid1_pager").jqGrid('navGrid', '#JQGrid1_pager', { edit: true, add: true, del: true });
}
})(jQuery);
function getSelectedRows() {
var grid = $("#JQGrid1");
//var rowkey = jQuery("#JQGrid1").jqGrid('getGridParam', 'selarrrow');
//var rowids = grid.jqGrid('getGridParam', 'selrow');
var rowids = jQuery("#JQGrid1").getGridParam('selrow');
alert(rowids);
var rowKey = grid.getGridParam("selrow");
alert(rowkey);
if (!rowKey)
alert("No rows are selected");
else {
var selectedIDs = grid.getGridParam("selarrrow");
var result = "";
for (var i = 0; i < selectedIDs.length; i++) {
result += selectedIDs[i] + ",";
}
alert(result);
}
}