Reputation: 5370
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'
}
},
Upvotes: 1
Views: 5816
Reputation: 11486
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:
// your column model
Ext.define('Whatever', {
extend: 'Ext.data.Model',
fields: [
...,
{name: 'Created', type: 'date', dateFormat: 'm/d/Y H:i'},
...,
]
});
Column config should be something like this (use editor
config - not field):
columns: [..., {
// date column
id: 'Created',
xtype: 'datecolumn',
header: 'Created',
dataIndex: 'Created',
width: 150,
sortable: true,
editor: {
xtype: 'datefield',
allowBlank: true,
format: 'm/d/Y H:i',
}, ...
}]
Upvotes: 2