我收到错误消息:
Microsoft JScript 运行时错误:“prmGridDialog”未定义
双击 jQgrid 中的一行时。当我使用工具栏按钮时,对话框打开。其他一切工作正常。这是jQuery:
<script src="~/Scripts/jquery.jqGrid.min.js"></script>
<script src="~/Scripts/i18n/grid.locale-en.js"></script>
<script src="~/Scripts/json2.min.js"></script>
<script src="~/Scripts/jquery.jqGrid.src.js"></script>
<link href="~/Content/jquery.jqGrid/ui.jqgrid.css" rel="stylesheet" />
$(document).ready(function() {
$.jgrid.nav.addtext = "Add";
$.jgrid.nav.edittext = "Edit";
$.jgrid.nav.deltext = "Delete";
$.jgrid.edit.addCaption = "Add Item";
$.jgrid.edit.editCaption = "Edit Item";
$.jgrid.del.caption = "Delete Contact";
$.jgrid.del.msg = "Delete selected item?";
var updateDialog = {
url: '/VisitorProducts/EditjQGridData'
, closeAfterEdit: true
, closeOnEscape: true
, modal: true
, width: "400"
};
var addDialog = {
url: '/VisitorProducts/AddjQGridData'
, closeAfterAdd: true
, closeOnEscape: true
, modal: true
, width: "400"
};
var deleteDialog = {
url: '/VisitorProducts/DeletejQGridData'
, closeAfterEdit: true
, closeOnEscape: true
, modal: true
, width: "400"
};
jQuery("#list2").jqGrid({
url: '/VisitorProducts/jQgridData?visitorId=32'
, datatype: "json"
, colNames: ['RowId', 'VisitorId', 'Product Name']
, colModel: [
{ name: 'RowId', index: 'RowId', width: 150, editable: false, edittype: 'text', key: true },
{ name: 'VisitorId', index: 'VisitorId', width: 150, editable: true, edittype: 'text' },
{ name: 'ProductName', index: 'ProductName', sortable: true, align: 'left', width: 250, editable: true, edittype: 'text', editoptions: { size: 50 } }
]
, rowNum: 10
, rowList: [10, 20, 30, 50]
, pager: '#pager2'
, sortname: 'RowId'
, viewrecords: true
, sortorder: "desc"
, caption: "Visitor Products"
, rownumbers: false
, autowidth: true
, recreateForm: true
, ondblClickRow: function (rowid, iRow, iCol, e) {
$("#list2").editGridRow(rowid, prmGridDialog);
}
}).navGrid('#pager2',
{ edit: true, add: true, del: true, search: true, refresh: true }
, updateDialog
, addDialog
, deleteDialog
);
});
不确定我是否遗漏了什么。