-
27 Dec 2009 12:35 PM #11
Thanks a lot I was able to solve my display problem.
I am facing another issue where the date is coming as "dob":"1980-12-25T00:00:00" in JSON even though the format is set as 'm-d-Y'.
Display is working fine but when the form is submitted date format is not working. am I missing anything here.
Thanks...Code:var reader = new Ext.data.JsonReader({ totalProperty: 'recordCount', successProperty: 'success', idProperty: 'pid', root: 'records' }, [ {name: 'dob', allowBlank: false , type:'date' , dateFormat:'d-m-Y H:i'}, ]); var writer = new Ext.data.JsonWriter({ writeAllFields: true, listful : true }); var userColumns = [{ header: "Date Of Birth", width: 40, sortable: true, dataIndex: 'dob', renderer:Ext.util.Format.dateRenderer('m-d-Y'), editor: new Ext.form.DateField({ name: 'dob_date', width:90, allowBlank:false }) }/*, you have a trailing comma here --- indent your code properly!!!! */ ];Last edited by mystix; 28 Dec 2009 at 12:30 AM. Reason: POST CODE IN [code][/code] TAGS. see http://extjs.com/forum/misc.php?do=bbcode#code
-
28 Dec 2009 12:53 AM #12
a grid renderer only renders data for display.
it doesn't control the format in which the data is sent to the server.
you need to format the dob column's underlying js Date object into an appropriate date string before sending it to the server. otherwise, the default date string format (i.e. "Y-m-d\\TH:i:s") will be used.
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
3 Feb 2010 2:12 AM #13
server date format problem - same result
server date format problem - same result
hi. i got similar problem. i send from server date in 2 formats:
1. "Tue Jan 11 18:24:59 GMT+05:30 2007"
rows:[{...,"date_realization":"Tue Jan 11 18:24:59 GMT+05:30 2007",...}]
2. "2007-02-02 00:01:01"
rows:[{...,"date_realization":"2007-02-02 00:01:01",...}]
ad1. it renders ok every time (i dont even need type:'date' in store.reader.fields)
ad2.
if i got no type:'date' in store.reder.fields it renders as : NaN/NaN/NaN
but if i have type:'date', result depends on rendering function:
- if i use new Ext.util.Format.dateRenderer('d/m/Y') - i got nothing (blank) in the grid cell.
- if i use function(v){return new Date(v).format('d/m/Y')}, - i got always 01/01/1970 (thats not my date!)
What is going on? How does server data should look like?
I want to send date in ISO like: yyyy-MM-dd hh:mm
s
ADNOTATION
i also managed to render this server format:
rows:[{....,"date_realization":1260763250000,....}] - no quots
by using function(v){return new Date(v).format('d/m/Y')} and no type:'date' in store.reader.field
but i really want to do it right with iso format. yyy-mm-dd hh:mm: ss
ANSWER
,type:'date',dateFormat:'c'...
-
3 Feb 2010 8:01 AM #14
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
1 Mar 2010 12:25 AM #15
I have problem too. But ExtJs 3.1.1
grid columnsCode:var store = new Ext.data.JsonStore({ ... ,root: 'data' ,totalProperty: 'totalCount' ,fields: [{name:'acctstarttime',type:'date',dateFormat:'Y-m-d H:i:s'}, {name:'acctstoptime',type:'date',dateFormat:'Y-m-d H:i:s'}, 'acctsessiontime', 'acctinputoctets', 'acctoutputoctets','callingstationid'] ... });
server returnCode:... columns: [ { header: 'Начало сессии', dataIndex:'acctstarttime', renderer: Ext.util.Format.dateRenderer('d.m.Y H:i:s') },{ header: 'Конец сессии', dataIndex:'acctstoptime', renderer: Ext.util.Format.dateRenderer('d.m.Y H:i:s') } ...
acctstoptime rendered in grid as '30.11.1899 00:00:00'Code:{"totalCount":"132","data":[{"acctstarttime":"2010-03-01 09:20:45","acctstoptime":"0000-00-00 00:00:00" ...
-
1 Mar 2010 1:56 AM #16
There is nothing built into the Date class that detects "0000-00-00 00:00:00" from your server as a null date entry.
you'll need to write a custom renderer function for the respective column, or a custom convert function in your Store's Record definition, to deal specifically with the "0000-00-00 00:00:00" date string sent from your server.
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
10 Mar 2010 9:43 AM #17
If you are using mysql you can just use "NULLIF(ColumnName,'0000-00-00') as ColumnName" in the query to change zero dates to null and solve the 1970's problem.
-
10 Mar 2010 10:12 AM #18
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
5 Apr 2011 12:57 AM #19
DateField shows time and ate when click on roweditor update button
DateField shows time and ate when click on roweditor update button
Hi,
I am facing different problem, which I am unable to configure. I resoved my problem of NaNNaNNaN by rendering datefield as editor : new fm.DateField({
format:'d/m/Y',
renderer :Ext.util.Format.dateRenderer('d/m/Y')
})
But when I select date from datefield and hit update button of roweditor, I get date format as for eg : Mon Apr 02 2012 00:00:00 GMT+0100 (GMT daylight Time). I want to appear the date as 02-04-2011.
Please let me know how to do settings.
-
27 Dec 2012 5:41 AM #20


Reply With Quote


