Holiday Notice: Support will be provided on a limited scale from December 24th, 2024, to January 2nd, 2025. Happy holidays and a wonderful New Year!


Topic: Change row class based on column value datatables

jmztaylor premium asked 1 year ago


Just as title says. Is this possible?

Snippet


Mateusz Lazaru staff answered 1 year ago


https://mdbootstrap.com/snippets/standard/mlazaru/5222865#js-tab-view

In this code, a function iterates over all the rows and add a class based on the first cell's value.


jmztaylor premium commented 1 year ago

After wrapping in .on('render.mdb.datatable') it worked perfectly. Loading data via fetch so had to wait till after. Thanks!


Mateusz Lazaru staff answered 1 year ago


Unfortunately, datatable does not have an option to pass classes to the rows. You would need to do that manually.


jmztaylor premium commented 1 year ago

Do you have an example of how to do that?



Please insert min. 20 characters.

FREE CONSULTATION

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

Status

Resolved

Specification of the issue

  • ForumUser: Premium
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 6.2.0
  • Device: Pc
  • Browser: Chrome
  • OS: w11
  • Provided sample code: No
  • Provided link: Yes