Topic: Number formatting in Datatable

Carl Malouf free asked 4 years ago


Expected behavior Set a particular format required of datatable columns (e.g. number in currency format ($XXX,XXX.00) thousand separators, 2 decimal places) and ability to right-align those columns individually.

Actual behavior No obvious ability to apply horizontal alignment by column or specify a formatter function.

Resources (screenshots, code snippets etc.) Similar ability to https://bootstrap-table.com/ would be good. They allow specification of a 'data-formatter' attribute per column which can call a JS formatter function. Also allows for setting a horizontal alignment option per column.


tillmr premium answered 3 years ago


is there any update regarding this problematic?


Marcin Luczak staff commented 3 years ago

MDB5 Datatables allows custom cell formatting: https://mdbootstrap.com/docs/standard/data/datatables/#section-cell-format

Keep coding, Marcin


futureweb priority commented 3 years ago

Are there any predefined formats like date, currency?


Marcin Luczak staff commented 3 years ago

Hi @futureweb,

We do not provide any predefined formats for date or currency as this can be achieved with just JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat

Keep coding, Marcin


Krzysztof Wilk staff answered 4 years ago


Hi!

Thanks for your suggestion! It would be nice to have these features in our package, so we'll try to implement them as soon as possible :)

Best regards



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: Other
  • MDB Version: -
  • Device: Computer
  • Browser: Edge
  • OS: Windows 10
  • Provided sample code: No
  • Provided link: Yes