How to add custom class for datatable?


Topic: How to add custom class for datatable?

IT_Santini pro premium priority asked 3 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.) https://mdbootstrap.com/snippets/standard/it_santini/3710047


Grzegorz Bujański staff answered 3 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.

FREE CONSULTATION

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

Status

Answered

Specification of the issue
  • User: Pro
  • 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