-
14 Aug 2009 11:40 AM #1
Ext.form.DateField - formatting ignored?
Ext.form.DateField - formatting ignored?
I have an editorgrid and a few date fields, when I edit these using the Ext.form.DateField, it returns a very detailed string to the server.
All I need is m-d-Y, and I have specified that within my editor and the column model. When I manually enter dates to the db in the proper form YYYY-MM-DD, they render fine in the grid. How to I change the output of the date picker to store my desired format?Code:Wed Jul 25 1900 00:00:00 GMT-0500 (Central Daylight Time)
Thanks!
-
14 Aug 2009 11:42 AM #2
Confused.
EditorGridPanels don't submit anything.
So. You have some DateFields in a form which you are submitting?Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Aug 2009 11:51 AM #3
I am using the date picker within an editor grid.
-
14 Aug 2009 11:57 AM #4
How have you set up the editor grid to communicate with ther server?
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Aug 2009 12:02 PM #5
Good question, and I was fearing that might be my issue. At current afteredit performs a commit, possibly not giving the date a chance to get formatted?
I would like to have an 'update' button to commit all the dirty fields once I am done editing.
Thanks!
-
14 Aug 2009 12:04 PM #6
You using some of this new Ext.direct stuff? I mean you can't just use a normal EditorGridPanel and expect to update the server in any way!
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Aug 2009 12:08 PM #7
hmm...
...Code:var grid = new Ext.grid.EditorGridPanel
I guess that is my problem then... Very dirty and dangerous, I just set it up that way for testing - I think I will work on adding that update button nowCode:listeners: { afteredit: function(e) { var conn = new Ext.data.Connection(); conn.request({ url: 'quickchart.php?act=update', params: { id: e.record.id, field: e.field, value: e.value }, success: function(resp, opt) { grid.getStore().getById(opt.params.id).commit(); }, failure: function(resp, opt) { grid.getStore().getById(opt.params.id).reject(); } });
Thanks!
-
14 Aug 2009 12:14 PM #8
OK, you just use e.value? It's a Date, and what do you EXPECT it to do? Read your mind?
It just does a toString()
If you want it formatted, format it.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
14 Aug 2009 1:46 PM #9
Thanks for the info! This is all new to me
I need to step back and take a different look at the project.
Thanks Again!
-
14 Aug 2009 5:49 PM #10
I eventually came up with this...
Thanks!Code:listeners: { afteredit: function(e) { var value = Ext.isDate(e.value) ? e.value.format("Y-m-d") : e.value; console.log(e.value); var conn = new Ext.data.Connection(); conn.request({ url: 'quickchart.php?act=update', params: { id: e.record.id, field: e.field, value: value }.......


Reply With Quote