PDA

View Full Version : Grid datecolumn problem



brandname
28 Feb 2012, 2:40 AM
Hi. I have simple grid with date column:


Ext.create('Ext.data.Store', {
storeId:'sampleStore',
fields:[
{ name: 'topday', type: 'date' }
],
data:[
{ topday: '04/01/2010' },
{ topday: '15/02/2010' },
{ topday: '26/03/2010' },
{ topday: '17/04/2010' }
]
});

Ext.create('Ext.grid.Panel', {
title: 'Date Column Demo',
store: Ext.data.StoreManager.lookup('sampleStore'),
columns: [
{ text: 'Top Day', dataIndex: 'topday', xtype: 'datecolumn', format:'d.m.Y' }
],
height: 200,
width: 450,
renderTo: Ext.getBody()
});


result:
32196
What happend with date in grid?

Farish
28 Feb 2012, 3:46 AM
In the grid column, you are using format which is set to "days.months.year" that is why they are displayed like that. You need to set format in your store field:


fields:
[
{name: 'date', type: 'date', dateFormat: 'd/m/Y'},
]