Custom Sort of fm highcharts data

Answered
Shahul Hameed asked on January 3, 2022

Hi team,
Currently data from FM grid/report is sorted in ascending alphabetical order. Is there any way to get in customised way. we have data in rows having month-year format. for example Jul-2020. We need sorted months in chronological way and not alphabetical way, as it makes Apr and Aug to appears first

3 answers

Public
Mykhailo Halaida Mykhailo Halaida Flexmonster January 4, 2022

Hi Shahul,
 
Thank you for raising your support ticket.
 
Since you're using a custom date field format, it is not sorted chronologically by default. However, you can easily implement custom sorting in Flexmonster with the sortingMethod() API call.
 
We've prepared a quick JSFiddle sample to illustrate this: https://jsfiddle.net/flexmonster/a72r8y6o/.
 
See the following documentation page for a more detailed tutorial on custom sorting: https://www.flexmonster.com/doc/sorting/.
 
Please let us know if this helps.
 
Best regards,
Mykhailo

Public
Shahul Hameed January 12, 2022

Hi Mykhailo,
Sorry for late reply and thanks for your response. I did our custom sorting on the FM data received via highcharts connector itself before above response and fixed our solution. Still, to let you know, the above sample works for same year data, but if we have Aug-2019, Jan-2020...Dec-2020. Aug-2019 appears before Aug-2020 and not before Jan-2020

Public
Vera Didenko Vera Didenko Flexmonster January 13, 2022

Hi Shahul,
 
Thank you for the update.
 
We are happy to hear that it worked to display the month-year members in the correct order.
Regarding the sample, thank you for noticing. The custom sorting method approach would need a few adjustments to cover the several-years scenario.
 
As always, should other questions arise, feel free to reach out.
 
Kind regards,
Vera

Please login or Register to Submit Answer