extjs 4 网格中的日期列为空
我的网格中有一个日期列。有没有办法确保日期值不为空。
即见下图。该字段有一个日期。但是当我双击编辑时,该值被清除。
{
id: 'Created',
text: "Created",
dataIndex: 'Created',
xtype: 'datecolumn',
format: 'd/m/Y H:m',
width: 150,
sortable: true,
field: {
xtype: 'datefield',
allowBlank: true,
format: 'd/m/Y H:m'
}
},
I have a datecolumn in my grid. Is there a way to ensure than that the date value will not be empty.
ie see the below image. This field has a date. But when i double click to edit the value is cleared.
{
id: 'Created',
text: "Created",
dataIndex: 'Created',
xtype: 'datecolumn',
format: 'd/m/Y H:m',
width: 150,
sortable: true,
field: {
xtype: 'datefield',
allowBlank: true,
format: 'd/m/Y H:m'
}
},
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
日期格式中的最后一个“m”指的是月份,如果您希望它指的是分钟,则应该是
'd/m/YH:i'
。另外,从您的屏幕截图来看,它应该以月份为首'm/d/Y/ H:i'
除非将来每个月的 2 号都会发生一些事情,例如您的“ 02/08/2012”应该为 2012 年 8 月 2 日。不过要回答您的问题:请确保您具有模型中定义的格式(看起来可能是这样,因为它在没有编辑器的情况下渲染正常) ),但不能告诉:
列配置应该是这样的(使用
editor
配置 - 而不是字段):Your last 'm' in the dateformat refers to the month, it should be
'd/m/Y H:i'
if you want it to refer to the minutes. Also by the looks of your screenshot, it should have month first'm/d/Y/ H:i'
unless there is something going on on the 2nd of every month in the future, e.g. your "02/08/2012" is supposed to be 2 August 2012. To answer your question though:Make sure you have the format defined in the model (it looks like you may because it renders ok without the editor), can't tell though:
Column config should be something like this (use
editor
config - not field):