« Return to Thread: Date formatting and sorting?

Re: Date formatting and sorting?

by aparajita :: Rate this Message:

Reply to Author | View in Thread

> 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/

 « Return to Thread: Date formatting and sorting?