View Full Version : date format on grid. Format is not displayed as expected.

26 Jan 2007, 1:55 PM
Grid column is defined as

{header: "ChgStartDt", width: 99,renderer: formatDate, sortable: true,editor: new yg_myself.DateEditor({format: 'Y-m-d'})}
and formatDate function is:

var formatDate = function(value) {
return value.dateFormat('Y-m-d');

When the grid is rendered, the dates appear correct (e.g. 2006-10-02). After I edit them, I sometimes see the correct formatting but after a redraw from a server trip or other cases I haven't been able to narrow down, I get the formatting:

Mon Oct 2 00:00:00 PDT 2006

This is also the value I get in the afterEdit event.

Is there something I am missing in the afterEdit event? Or anything else I am doing wrong?


26 Jan 2007, 2:08 PM
What is 'new yg_myself.DateEditor'? I could see if you were aliasing YAHOO.ext.Grid as yg, you would
do new yg.DateEditor(...), but you're code makes me wonder if you're doing something else.

26 Jan 2007, 2:31 PM
oh sorry, I generated the grid definitions from a java servlet. I can have multiple on a page based on my apps widget defintions. The grids are defined with variables appended with the association name
as in
var _myself = {
init : function() {
var yg_myself = YAHOO.ext.grid;


_myself is just an assoction defined on the screen I am working with. Funny name is due to an association back to itself...

26 Jan 2007, 4:05 PM
OK I was just being slow with JavaScript.

if (value && value instanceof Date) {
valueForServer = value.format("Y-m-d");

In my afterEdit method did the trick.

I sent Jack $50 paypal just now for saving my but at work with his editable grid.