Jquery JQgrid日期选择器问题?
在我的JQgrid中,我使用内联单元格编辑,这样当我在中从一个日期单元格切换到另一个日期单元格时,会生成Jquery JQgrid日期选择器问题?,jquery,jqgrid,Jquery,Jqgrid,在我的JQgrid中,我使用内联单元格编辑,这样当我在中从一个日期单元格切换到另一个日期单元格时,会生成未捕获类型错误 错误如下: Uncaught TypeError: Cannot read property 'dpDiv' of undefined jquery-ui-1.8.19.custom.min.js:65 我认为出错的是,datepicker字段中的keydown事件被触发,当它执行时发现dpDiv为空。为了克服这一点,我尝试在按下Tab键时销毁keydown事件,但这里没有运
未捕获类型错误
错误如下:
Uncaught TypeError: Cannot read property 'dpDiv' of undefined jquery-ui-1.8.19.custom.min.js:65
我认为出错的是,datepicker字段中的keydown事件被触发,当它执行时发现dpDiv
为空。为了克服这一点,我尝试在按下Tab
键时销毁keydown事件,但这里没有运气
这就是我正在做的事情,它产生了这个错误:
afterEditCell: function (id, name, val, iRow, iCol) {
var cModel = $grid.jqGrid("getGridParam", "colModel");
var currCol = cModel[iCol].name;
var $row = $grid.find('.jqgrow#' + id);
var $columns = $row.find('td');
$td = $($columns[iCol]);
if (isAnyDate(iCol)) {
$td.find('input').addClass('textBoxStyle').datepicker().keyup(function (e) {
var code = e.which || e.keyCode;
if (code == 9)
$(this).datepicker('destroy');
});
}
});
当鼠标点击用于单元格导航时,效果很好
有人需要帮助吗?可能是因为无法获取密钥事件,请尝试使用以下方法: 改为使用
keyup
尝试使用keypress
或keydown
if (isAnyDate(iCol)) {
$td.find('input').addClass('textBoxStyle').datepicker().keydown(function (e) {
var code = e.which || e.keyCode;
if (code == 9)
$(this).datepicker('destroy');
});
}
或者这个:
if (isAnyDate(iCol)) {
$td.find('input').addClass('textBoxStyle').datepicker();
$(document).on('keydown', '.textBoxStyle', function(e) {
var code = e.which || e.keyCode;
if (code == 9)
$(this).datepicker('destroy');
});
}
在小提琴手身上试过:
试试这个,看看是否有帮助。您使用的是哪种浏览器,我正在IE8上试用,错误依然存在。.两种浏览器都试过了!你检查过小提琴了吗?小提琴好像坏了,在chrome 23.0.1271.97上试过。你能为它做一把小提琴吗?对于我运行的fiddle,两个浏览器中都没有捕获tab键事件