PDA

View Full Version : Set format for ALL DateColumns in grids.



wuschba
21 Feb 2011, 6:57 AM
Hello! I use:
{name:'myName', type:'date'},
to define a column in a gridpanel. This is done automatically from a script I'm not able to change.

What I get is a fine DateColumn, but the format is:
"Mon Feb 21 2011 01:00:00 GMT+0100"

I just want a format like:
"21.02.2011".

So I added this before all of my code:
Ext.grid.DateColumn.prototype.format = "d.M.Y";
but it doesn't seem to have any effect at all. Any idea how to set the format for ALL Ext.grid.DateColumns to "d.M.Y"?

Condor
21 Feb 2011, 7:02 AM
A DateColumn only formats the date according to your specified 'format' if the value is actually a Date instance.

I assume you've configured the field that holds the date incorrectly (needs type:'date', dateFormat: '...').