PDA

View Full Version : DateFields in EditorGridPanel



mclovin
24 Jul 2009, 11:21 AM
Hello,

I am having trouble processing dates in my grid panel. Maybe I'm missing the concept here. As I see it, there are two pieces to pay attention to when it comes to working with a DateField in an EditorGridPanel: (1) renderer and (2) editor. When I send my data to the server side after changing the date, I get the following date format:

2009-07-21T00:00:00

What is that 'T' all bout in the middle of the date and time? Has anyone else experiences this?

Here is the renderer that I'm using:
renderer: Ext.util.Format.dateRenderer('m/d/Y')

Here is the editor that I am using:
var startDate = new Ext.form.DateField({format: 'm/d/Y'});

Note that both the renderer and editor use the same format so why is the date coming accross so funky? How do I fix that?

-Jim

tryanDLS
24 Jul 2009, 1:04 PM
Renderer specifies how the date is displayed in the grid, format on the DataField specifies how it's handled in the date widget. Neither affects how it's treated when it's serialized and sent back to server.

mclovin
24 Jul 2009, 1:39 PM
Thanks for the response Tim. I actually got it to work by formatting the date value before it's sent over to the server in the handler:

record.data.startdate = record.data.startdate.format('m/d/Y');
record.data.enddate = record.data.enddate.format('m/d/Y');

Worked for me!
-Jim