FlexGrid sorting dates by their string representation

Posted by: marooned on 4 October 2018, 9:20 pm EST

    • Post Options:
    • Link

    Posted 4 October 2018, 9:20 pm EST

    I’m having issue with FlexGrid and sorting by date.

    The data provided for the grid has date field set as Date object, I can change the displayed format using [format] parameter (actually I’m using template but that’s not important). [dataType] is set to “4” too yet the sorting seems to be using string representation ( (new Date()).toString() ).

    For debugging purpose, here is how it looks sorted by date with format as: ```

    {{item.lastUpdate}} || {{formatDate(item.lastUpdate, ‘yyyy-mm-dd hh:ss’)}}

    
    * "* "Fri Aug 31 2018 13:22:00 GMT+0200 (Central European Summer Time) || 2018-08-31 01:00"
    
    * "Sat Jul 21 2018 14:22:00 GMT+0200 (Central European Summer Time) || 2018-07-21 02:00"
    
    * "Tue Sep 04 2018 14:22:00 GMT+0200 (Central European Summer Time) || 2018-09-04 02:00"
    
    * "Wed Aug 29 2018 14:22:00 GMT+0200 (Central European Summer Time) || 2018-08-29 02:00"
    "
    
    
    It's clear that it's sorted alphabetically (Fri, Sat, Tue, Wed) and not by date (August as 1st and the last one).
    
    Any clue?
    Thanks
  • Posted 7 October 2018, 4:24 pm EST

    We are unable to replicate the issue at our end with latest Wijmo version(5.201182.524).

    Could you please have a look at the following sample(used for testing) and let us know what we are missing to replicate the issue: https://stackblitz.com/edit/angular-eztw8k?file=app%2Fapp.component.html

    The issue could arise if dates are string, please confirm that date objects are actually the instance of ‘Date’ class and not just strings.

    Also could you please let us know about the Wijmo version you are using so that we may test on the same version.

    ~Sharad

  • Posted 17 October 2018, 12:35 am EST

    Thanks for your input. In the meantime we found out that it was the other developer’s code that altered data on the fly and was causing that issue, so no problems from Wijmo side.

  • Posted 22 October 2018, 6:23 pm EST

    Thanks for notifying us.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels