|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Date formatting and sorting?I've got a grid where I'm needing to format and sort a date field, but
running into several issues. If I do a simple render function as follows: renderer:Ext.util.Format.dateRenderer('m/d/Y') This works OK, but if I have an empty date field I get "NaN/NaN/NaN" for the field, and the sort does not appear to work in date order. It's wanting to sort the field as if it where an alpha. The date field is defined simply as fields :[ 'due' ] I've also tried {name:'due', type:'date', dateFormat:'n/j h:ia'}, but this causes errors on my end. The grid does not display any data if I define it as such. Thanks, Christian Cypert ccypert@... It is a rare mind indeed that can render the hitherto non-existent blindingly obvious. The cry 'I could have thought of that' is a very popular and misleading one, for the fact is that they didn't, and a very significant and revealing fact it is too. - Douglas Adams _______________________________________________ Active4D-dev mailing list Active4D-dev@... http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ |
|
|
Re: Date formatting and sorting?Christian,
I did a prototype in Ext about 18 months ago and vaguely recall a similar problem. In looking at that code I was returning Date Time Stamps (an Alpha(14) as YYYYMMDDhhmmss)) as strings. My renderer did output the dates as MM/DD/YYYY hh:mm:ss though, and I would have had situations where I had empty dates. I also sorted on on of the dates prior to building my rowset. Are you mapping JSON to a RowSet a Selection? In either case, you may be need to convert your dates to a string before sending back the JSON. The returned JSON may need to be in YYYY-MM-DD or something like that. If I had access to that server I'd fire up that project and see what I was sending back. The Ext Forums or online Documents might better answer what the expected return format is. hth, Brad Perkins Christian Cypert wrote: > I've got a grid where I'm needing to format and sort a date field, but > running into several issues. If I do a simple render function as follows: > > renderer:Ext.util.Format.dateRenderer('m/d/Y') > > This works OK, but if I have an empty date field I get "NaN/NaN/NaN" > for the field, and the sort does not appear to work in date order. > It's wanting to sort the field as if it where an alpha. > > The date field is defined simply as > > fields :[ > 'due' > ] > > I've also tried {name:'due', type:'date', dateFormat:'n/j h:ia'}, but > this causes errors on my end. The grid does not display any data if I > define it as such. > > Thanks, > > Christian Cypert > ccypert@... > > It is a rare mind indeed that can render the hitherto non-existent > blindingly obvious. The cry 'I could have thought of that' is a very > popular and misleading one, for the fact is that they didn't, and a > very significant and revealing fact it is too. > - Douglas Adams > > > > > > _______________________________________________ > Active4D-dev mailing list > Active4D-dev@... > http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev > Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ > _______________________________________________ Active4D-dev mailing list Active4D-dev@... http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ |
|
|
Re: Date formatting and sorting?> I've got a grid where I'm needing to format and sort a date field,
> but running into several issues. If I do a simple render function as > follows: > > renderer:Ext.util.Format.dateRenderer('m/d/Y') > > This works OK, but if I have an empty date field I get "NaN/NaN/NaN" > for the field, and the sort does not appear to work in date order. > It's wanting to sort the field as if it where an alpha. > > The date field is defined simply as > > fields :[ > 'due' > ] If the date data is being passed back via JSON using the a4d.json library, you have to declare the date fields in your JsonStore like this: fields: [ 'id', { name: 'date', type: 'date', dateFormat: 'Y-m-d' }, 'title', 'contact', { name: 'notes_length', type: 'int' }, 'pa_email', 'pa_name' ], Regards, Aparajita www.aparajitaworld.com "If you dare to fail, you are bound to succeed." - Sri Chinmoy | www.srichinmoy.org _______________________________________________ Active4D-dev mailing list Active4D-dev@... http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ |
|
|
Re: Date formatting and sorting?Christian -
If you didn't get this fixed already let me know - I have empty dates coming from Active4D -> Ext grid working OK, so I can take a look at my code if that helps... Regards John On 27 Apr 2009, at 9:39 pm, Christian Cypert wrote: > I've got a grid where I'm needing to format and sort a date field, > but running into several issues. If I do a simple render function as > follows: > > renderer:Ext.util.Format.dateRenderer('m/d/Y') > > This works OK, but if I have an empty date field I get "NaN/NaN/NaN" > for the field, and the sort does not appear to work in date order. > It's wanting to sort the field as if it where an alpha. > > The date field is defined simply as > > fields :[ > 'due' > ] > > I've also tried {name:'due', type:'date', dateFormat:'n/j h:ia'}, > but this causes errors on my end. The grid does not display any data > if I define it as such. > > Thanks, > > Christian Cypert > ccypert@... > > It is a rare mind indeed that can render the hitherto non-existent > blindingly obvious. The cry 'I could have thought of that' is a very > popular and misleading one, for the fact is that they didn't, and a > very significant and revealing fact it is too. > - Douglas Adams > > > > > > _______________________________________________ > Active4D-dev mailing list > Active4D-dev@... > http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev > Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ _______________________________________________ Active4D-dev mailing list Active4D-dev@... http://mailman.aparajitaworld.com/mailman/listinfo/active4d-dev Archives: http://mailman.aparajitaworld.com/archive/active4d-dev/ |
| Free embeddable forum powered by Nabble | Forum Help |