最近,我在使用 jqGrid 来表示我的业务数据集,我发现 jqGrid 有编辑/添加/删除/查看功能,所以我尝试使用它。但是我遇到了一个问题,我尽力而为后无法解决。
我按照本网站的示例进行操作:
jQuery("#deptGrid").jqGrid('navGrid', '#deptNav', {
view : true
},
{
jqModal : true,
checkOnUpdate : true,
savekey : [ true, 13 ],
navkeys : [ true, 38, 40 ],
checkOnSubmit : true,
reloadAfterSubmit : false,
closeOnEscape : true,
bottominfo : "Fields marked with (*) are required"
}, {
jqModal : true,
checkOnUpdate : true,
savekey : [ true, 13 ],
navkeys : [ true, 38, 40 ],
checkOnSubmit : true,
reloadAfterSubmit : false,
closeOnEscape : true,
bottominfo : "Fields marked with (*) are required"
}, {
reloadAfterSubmit : false,
jqModal : false,
closeOnEscape : true
}, {
closeOnEscape : true
}, {
navkeys : [ true, 38, 40 ],
height : 250,
jqModal : false,
closeOnEscape : true
});
更新:以下是我的全部内容:
<link rel="stylesheet" type="text/css" href="<%=BASE_PATH %>admin/styles/stylesheet.css" />
<link rel="stylesheet" type="text/css" href="<%=BASE_PATH %>admin/js/jquery/ui/themes/ui-lightness/ui.all.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=BASE_PATH %>jqGrid4.4.1/themes/redmond/jquery-ui-1.8.2.custom.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=BASE_PATH %>jqGrid4.4.1/themes/ui.jqgrid.css" />
<link rel="stylesheet" type="text/css" media="screen" href="<%=BASE_PATH %>jqGrid4.4.1/themes/ui.multiselect.css" />
<!-- Including JS -->
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/jquery-ui-1.8.custom.min.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/superfish/js/superfish.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/tab.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/global.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/thickbox/thickbox.js"></script>
<link rel="stylesheet" type="text/css" href="<%=BASE_PATH %>admin/js/jquery/thickbox/thickbox.css" />
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/jquery.form.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/jquery.validate.js"></script>
<script type="text/javascript" src="<%=BASE_PATH %>admin/js/jquery/jquery-ui-timepicker-addon.js"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.bgiframe-2.1.2.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.core.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.widget.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.mouse.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.button.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.draggable.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.position.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.resizable.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.ui.dialog.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>admin/js/jquery/ui/jquery.effects.core.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>js/kevinshi.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>jqGrid4.4.1/js/jquery.jqGrid.src.js" type="text/javascript"></script>
<script src="<%=BASE_PATH %>jqGrid4.4.1/js/i18n/grid.locale-en.js" type="text/javascript"></script>
更新:每当我单击按钮进行编辑/添加/删除时,它总是会在萤火虫中导致错误:
$.type is not a function
var obj = $.type( pref );
我将其跟踪到 jqGrid 源代码中,此错误发生在文件的第 52 行,jquery.jqGrid.src.js
如下所示:
stripPref : function (pref, id) {
var obj = $.type( pref ); // Happened at this line.
if( obj == "string" || obj =="number") {
pref = String(pref);
id = pref !== "" ? String(id).replace(String(pref), "") : id;
}
return id;
},
所以,就在这一刻,我可以说jQuery.type()
方法找到了,但是我已经包含了 library jquery.min.js
,我很困惑。