How can I sort month values in the calendar order?
At the moment they are being sorted in alphabetical order.
You can have a look at our sample at the following page:
https://dev602.mestec.net/
Username: flexmonster
Password: RHp75MJGpnZDxmK9
Thank you.
Hello,
Thank you for reaching out to us.
We have analyzed the data set from your example. It seems that you use simple strings to represent months (for example, "2021-Nov"). In this case, Flexmosnter will operate with the "STARTDT_MONTH" field similar to the simple strings, which results in alphabetical sorting order.
You can use one of the following approaches to achieve correct sorting.
The sortingMethod approach.
The sortingMethod
API call sets custom sorting for hierarchy members. For more details about defining custom sort please refer to the Custom sorting tutorial. You will need to compare different strings (for example, "2021-Sep" and "2021-Oct") to let Flexmonster know the correct order.
Using date
, year/month/day
, or year/quarter/month/day
data type.
Flexmonster supports different data types to help represent date and time. Data types are defined in the MappingObject. Flexmonster provides unique functionality (filtering by dates, correct sorting) for these types.
You will need to change the data format in your data set to match one of the supported formats:
Here is a simple example of using the year/month/day
data type: https://jsfiddle.net/flexmonster/L2xoyw8f/.
Please let us know if it helps.
Looking forward to hearing from you.
Kind regards,
Illia