Topic: Datatable Sort
BeldenSpartan premium asked 2 years ago
Is it possible to sort on formatted numerical values within a datatable?
Consider the examples provided in the documentation: https://mdbootstrap.com/docs/standard/data/datatables/
If we sort on Salary in any of the provided examples, it treats the salary as a string, so the sorted values are incorrect. Is it possible to sort formatted values (currency, etc.) as numbers instead of strings?
Haven't heard back...wanted to make sure my question wasn't missed. How can I pass it as a number yet format it as a currency in the table?
Sorting as a string in the provided example (https://mdbootstrap.com/docs/standard/data/datatables/#docsTabsOverview) doesn't make any sense.
In the following example I found for the jquery version (https://mdbootstrap.com/docs/b4/jquery/tables/datatables1/), it looks like sort can work on values formatted for currency. How do I do this in the standard version of MDB?
You need to pass it as a Number via JS instead of String and it will be sorted as Number.
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
- User: Premium
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 3.10.2
- Device: PC
- Browser: Chrome
- OS: Windows
- Provided sample code: No
- Provided link: Yes