SpreadJS, Sorting date values

Posted by: c1_jonc on 8 September 2017, 9:50 am EST

    • Post Options:
    • Link

    Posted 8 September 2017, 9:50 am EST

    Hello,

    While using the filter/sort option in SpreadJS on a date column it appears that the dates are sorted only by text and not by date value. It seems that wijmo has this capability to sort dates correctly (assigning date as the datatype), but for some reason SpreadJS does not. Is this the case? or am I not formatting something correctly?

    Code example attached.

  • Posted 8 September 2017, 9:50 am EST

    Hello,

    In the sample provided, you are setting the date as string values in the column and hence it is sorting or filtering the data as strings. You mus set the data as a date in SpreadJS column to get it working.

    Kindly refer to the attached sample used for testing. It correctly sorts the date value, considering them as dates. You simply need to click on the column header of first column to sort the dates in ascending order.

    Further, the formatting of the values in Spread, even depends on the culture, you may try setting the culture of your application, so as to get sorting working as expected. Kindly refer to the following documentation link:http://helpcentral.componentone.com/NetHelp/SpreadHClientUG/webframe.html#cellformat.html which discusses the similar issue.

    Hope it helps. In case the issue still persists, I would request you to modify the attached HTML Page to depict your issue, so that I can replicate the issue at my end and debug it further.

    Thanks,

    Manpreet Kaur

  • Posted 8 September 2017, 9:50 am EST

    Yes, that is perfect. Thank you for the clarification.

    For the community I am attaching my same example from the question but with the fix applied.

    Thank you for your help Manpreet.

Need extra support?

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

Learn More

Forum Channels