We have an issue that I don't see in the forums, which is making me think we are missing something obvious.
We have a date field in an editable grid. The field is defined by:
var df = new Ext.form.DateField({format: 'm/d/Y'}); QRFV Article and Review Format:: QRFV ARTICLE FORMAT:. YOU MAY SUBMIT ARTICLES AS TEXT ATTACHMENTS DIRECTLY All film titles are underlined, with date of production directly following in http://eng-wdixon.unl.edu/format.htmlHOME | APPROVED FORMAT FOR SUBMISSIONS TO THECOCHRANE COLLABORATION :: File Format: Microsoft Word - View as HTMLOct 16, 2008 This note describes the approved format for papers submitted to the are submitted for Steering Group meetings that is the date from http://www.cochrane.org/docs/ApprovedformatforpaperssubmittedtoCCSG16Oct08.docHOME |
o.editor = new Ext.grid.GridEditor(df);
I can enter a date such as 7/7/2007 into the field and it accepts it as valid. And when I use the datepicker it will return the date in the same format: 7/7/2007.
However, the result that is stored in the grid (and displayed when I turn off the grid renderer for that column) is the same as the Sample Date in date.js, which look like:
'Sat Jul 7 2007 15:05:01 GMT-0600 (Central Standard Time)' Excel date format - multi formats allowed? - Tech Support Guy Forums:: 8 posts - Last post: Apr 10, 2006Excel date format - multi formats allowed? 31; and any dates submitted with a year and month but no day are assigned the first day of http://forums.techguy.org/business-applications/456954-excel-date-format-multi-formats.htmlHOME | Lotus Sandbox - JavaScript Date Picker:: Nov 13, 2000 rating: 5 stars · Great! Just made a small modification for Swedish (European) date-format (Submitted by Kenneth Axi - 12/29/2000) http://www-10.lotus.com/ldd/sandbox.nsf/Threads/C1A3C1F8E69EDDBD85256996006E5BD0?OpenDocumentHOME |
Is it possible for me to control the format of the date that is actually stored in the grid? Our java based server-side code does not like this default format and I need to change it, or find a way to convert via Java.
Thanks,
Jim
but by passing a datevalue that is generic (yyyy-mm-dd) (optionally of course) you don't have to know what the dateFormat at the client side is.. (dd-mm-yyyy or mm-dd-yyyy is a lot difference) irt.org - JavaScript Date & Time FAQ Knowledge Base:: FAQ 170 How do you add a number of months to a date and then format the output? FAQ 470 How can I date/time stamp a form field as the form is submitted? http://www.irt.org/script/date.htmHOME |
I'm inserting the localization files, these files change the default date format... When i pass the date value to the server using form.submit() i like to parse the date without finding out which localization file was loaded by the client and thus what the data format was (not to mention the fact that i have to keep a list of the dateformat in the localization of ExtJs and my parsing routine at the server side)..
Thanks
Marco
Input forms don't do data format translations. Really, that's something that should be done on the back end system anyway, not at the view level.
Good work around! but .. built-in the dateField would be nicer :)
You could add a hidden to the form, subscribe to the change or blur event of the date field and write the value into the hidden in your desired format?
That's what subclassing is for. :D
That's not a date format, that's the result of a Date object being converted to a string for display. Internally all dates are stored as date objects. You can use a renderer to format them how you want within the grid. When loading them into the store, they should have a type:'date' defined as well.
Ok, thanks Jack.
So when I am submitting the grid's data to the server, I need to determine which columns are date, and then pull the data from the date object in the format I want, and then submit that.
Got it, thanks!
One thought to consider, Java cannot parse the native date format, I assume PHP can. So while it would be better to do some work on the server, that is not possible with Java. So in our case we were forced to create a custom ajax call for date fields (that first converts the format).
While the hidden column is a workable option, for people using java on the back end we would be forced to use that for all date columns.
So, if it isn't possible to pick the format, I would at least consider a format that is as universally recognized as possible.
If someone knows of a way to parse the default date format in Java, please let me know.
In Java we use the class java.text.DateFormat. It can parse things like January 1, 1970, 00:00:00 GMT. but not to the level of detail that ext is passing back to the server during the post.
Thanks,
Jim
That's not a date format, that's the result of a Date object being converted to a string for display. Internally all dates are stored as date objects. You can use a renderer to format them how you want within the grid. When loading them into the store, they should have a type:'date' defined as well.
But what when you have datapicker inside a form and use the action form.submit()? How can you change the format of the date that's being submitted to the form?
(i want to show a localized format using the ext-lang-.. files and submit a generic format like (yyyy-mm-dd))
Thanks
Marco
Nortel Unveils Vision, Strategy for Israeli High-Performance Net
Busy Friday Leads to Strong Close for Net Stocks
|