Topic: Sorting Problem with datatable
Good morning, everyone.
I'm pretty new to mdb, so i'm still learning a lot of things. I'm using the datatable component to render an asset list. Everything works fine, except for sorting behavior.
I have a column that has a date in italian format: "DD/MM/YYYY".
I know that if i change the format to "YYYY/MM/DD", it sorts perfectly.
How can i achieve that? Is there a builtin function in datatable? Didnt find any JS Data Attribute that does that or let me specify type and format for the column
Thanks in advance.
PS: I build the datatable through JS not plain HTML
Grzegorz Bujański staff answered 9 months ago
Unfortunately, all data in the datatable is converted to a string. So they are sorted like a string. Unfortunately, there is currently no way to change this behavior.
But soon we will release a new product - Data grid, which will be more advanced and will support sorting date columns.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 7.2.0
- Device: Laptop
- Browser: Chrome
- OS: W11
- Provided sample code: No
- Provided link: No