当我点击saveAllRows
时出现Cannot read property 'errcap' of undefined
错误..这是我的按钮代码
function saveAllRows(){
var ids = $("#jqGrid").jqGrid('getDataIDs');
var i;
for (i = 0; i < ids.length; i++) {
$("#jqGrid").jqGrid('saveRow', ids[i]);
}
}
这是我所包含的内容
<script type="text/ecmascript" src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<!-- We support more than 40 localizations -->
<script type="text/ecmascript" src="resources/grid.locale-en.js"></script>
<!-- This is the Javascript file of jqGrid -->
<script type="text/ecmascript" src="resources/jquery.jqGrid.js"></script>
<!-- A link to a Boostrap and jqGrid Bootstrap CSS siles-->
<script type="text/ecmascript" src="resources/bootstrap-datepicker.js"></script>
<script type="text/ecmascript" src="resources/jquery.timepicker.js"></script>
<script type="text/ecmascript" src="https://cdn.jsdelivr.net/jquery.ui.timepicker.addon/1.4.5/jquery-ui-sliderAccess.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" media="screen" href="resources/ui.jqgrid-bootstrap.css" />
<link rel="stylesheet" type="text/css" media="screen" href="resources/bootstrap-datepicker.css" />
<link rel="stylesheet" type="text/css" media="screen" href="resources/jquery.timepicker.css" />
<link rel="stylesheet" type="text/css" media="screen" href="resources/style.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
任何帮助......为什么会这样?
答案 0 :(得分:0)
错误
无法读取属性&#39; errcap&#39;未定义的
表示未定义类似$.jgrid.defaults.errors.errcap
,$.jgrid.locales["en-US"].errors.errcap
或$.jgrid.regional.en.errors.errcap
的字符串(取决于您使用的jqGrid的版本和分支)。如果您使用free jqGrid,则问题不存在,因为en-US语言环境的必需字符串在jquery.jqgrid.min.js
中定义。例如,要使用最新的免费jqGrid 4.13.3,您需要包含ui.jqgrid.min.css
和jquery.jqgrid.min.js
个文件
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.13.3/css/ui.jqgrid.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/free-jqgrid/4.13.3/js/jquery.jqgrid.min.js"></script>
包括您需要的所有内容。
如果你使用一些旧的jqGrid,例如jqGrid 4.6,那么你必须包含grid.locale-en.js
,它定义了一些特定于语言的字符串$.jgrid.defaults.errors.errcap
。然后包含的文件列表应该是以下
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/css/ui.jqgrid.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/i18n/grid.locale-en.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqgrid/4.6.0/js/jquery.jqGrid.min.js"></script>
答案 1 :(得分:0)
{ label: 'Date', name: 'Date', width: 150 , "formatter":"date",
editable: true,
edittype:"custom",
editoptions: {
autoclose: true,
autoOpen: false,
format: 'yyyy-mm-dd',
orientation : 'auto bottom',
showOn: 'both',
formatoptions :{"srcformat":"Y-m-d", "newformat":"m/d/Y"},
dataInit : function (elem) {
// $(elem).datepicker({autoclose: true});
//$(elem).datepicker('hide');
setTimeout(function(){
$(elem).datepicker({autoclose: true});
},10);
/*$(elem).on('changeDate', function(ev){
$(this).datepicker('hide');
});*/
},
custom_element: function(value, options) {
var parts = value.split(' ');
var elemStr = '<div><input size="6" id="txt_' +'" value="' + parts[0] +
'" /><input type="button" size="5" value="..."/></div>';
// return DOM element from jQuery object
return $(elemStr)[0];
},
custom_value: function(elem) {
var inputs = $("input", $(elem));
var first = inputs.value;
return first;
}
}
},