View Full Version : Date in GridPanel showing in wrong format

4 Jan 2011, 7:26 PM
A grid with an editable datefield. The server returns dates in yyyy-MM-dd format. The store looks like:

var gridStore = new Ext.data.JsonStore({
autoDestroy: true,
id: 'gridStore',
url: 'get_my_data_tab.php',
storeId: 'dataTabStore',
root: 'rows',
idProperty: 'd_entry_date',
fields: [{name:'d_entry_date', type: 'date', dateFormat: 'Y-m-d'},
'd_last_date', 'd_value', 'd_delta', 'd_percent']

The date column in the column model looks like:

columns: [{
id: 'col_d_entry_date',
header: 'Date',
dataIndex: 'd_entry_date',
format: 'Y-m-d',
width: 220,
// use shorthand alias defined above
editor: new Ext.form.DateField({
format: 'Y-m-d',
allowBlank: false
} [...etc]

I've tried various iterations with various symptoms. The current one is that the date shows in full UTC style when loading, Y-m-d format while editing, and then back to UTC when finished editing. Before I specified the type on the store, it would load right, but then turn to UTC after edit, so it was working closer to right, but it seems like specifying the type should be a good thing.

All i want is simply Y-m-d all the way through. What am I doing wrong here?

4 Jan 2011, 8:10 PM
try add

dataIndex: 'd_entry_date',
xtype: 'datecolumn',

to your column.