BeldenSpartan premium asked 10 months ago

Is it possible to sort on formatted numerical values within a datatable?

Consider the examples provided in the documentation:

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?

BeldenSpartan premium answered 10 months ago

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 ( doesn't make any sense.

In the following example I found for the jquery version (, it looks like sort can work on values formatted for currency. How do I do this in the standard version of MDB?

Dawid Wajszczuk staff commented 10 months ago

It can't be done currently. You can only add a number without the currency. But proper task has been added.

BeldenSpartan premium commented 10 months ago

With all due respect, this is a very big miss. I cannot use MDB if I have to choose between displaying unformatted numbers that can be sorted, or displaying formatted numbers that cannot be sorted. Either option is unacceptable.

Dawid Wajszczuk staff commented 9 months ago

Thanks for your feedback.

Dawid Wajszczuk staff answered 10 months ago


You need to pass it as a Number via JS instead of String and it will be sorted as Number.

Keep coding,

BeldenSpartan premium commented 10 months ago

How can I pass it as a number yet format it as a currency in the table?

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.



Specification of the issue

  • 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