【发布时间】:2013-08-23 20:33:54
【问题描述】:
我通过 jqgrid 与从 ajax 返回的 json 绑定。 json 具有以下格式的日期
11/1/2013 12:00:00 AM
在 colmodel 中我指定了以下内容
{ name: 'datecol', index: 'SignDate', width: '200', jsonmap: 'cell.SignDate', editable: true, sorttype: 'date',
editable: true, formatter: 'date', formatoptions: {
srcformat: 'm-d-Y H:i:s',
newformat: 'Y-M-d'
},
editoptions: { dataInit: initDateEdit },
initDateEdit = function(elem) {
setTimeout(function() {
$(elem).datepicker({
formatter: 'date', formatoptions: {
srcformat: 'm-d-Y H:i:s',
newformat: 'yy-M-d'
}
autoSize: true,
showOn: 'button', // it dosn't work in searching dialog
changeYear: true,
changeMonth: true,
showButtonPanel: true,
showWeek: true
});
//$(elem).focus();
},100);
}
这会在网格中正确显示日期
2013-Nov-01
但是当我点击添加新记录时,弹出窗口来了,当我选择日期并点击提交时,在网格中,新记录正在显示
NaN-undefined-NaN
在日期列中。这里有什么问题?
当我使用与此链接中给出的相同代码时 http://www.ok-soft-gmbh.com/jqGrid/LocalFormEditing.htm
编辑工作正常,但是当我添加新行时,日期为 NaN-undefined-NaN
请帮忙。
【问题讨论】:
标签: jquery-ui jqgrid jquery-ui-datepicker