Topic: How to add custom class for datatable?

IT_Santini priority asked 2 years ago

Expected behavior Can add custom class to a datatable table tag, either manually from html or from options javascript api attributes

Actual behavior Cannot add custom class to datatable table tag

Resources (screenshots, code snippets etc.)

Grzegorz Bujański staff answered 2 years ago

At the moment it is not possible. You can add this class with js code:

document.addEventListener('DOMcontentLoaded', () => {
  document.querySelector('datatable table').classList.add('custom-class');

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

  • ForumUser: Priority
  • Premium support: Yes
  • Technology: MDB Standard
  • MDB Version: MDB5 3.10.2
  • Device: Laptop
  • Browser: Chrome
  • OS: Windows
  • Provided sample code: No
  • Provided link: Yes