Topic: datatable search via data attributes

Pierre Grobbelaar priority asked 2 years ago

I use php to fetch mysqli data to dynamically populate the table. I want the search function to search table content through data attributes.

I cant get it to filter the data because I don't know how to activate the function. Please provide a generic example of the search function using data attributes instead of javascript.Mdb basic table example

Mejuto free answered 2 years ago

Work perfect! Thank you.


Dawid Wajszczuk staff answered 2 years ago


You just need to write this JS code

const instance = mdb.Datatable.getInstance(document.querySelector('.datatable'));

document.querySelector('#datatable-search-input').addEventListener('input', (e) => {;

Here is the snippet

Keep coding,

Pierre Grobbelaar priority commented 2 years ago

Exactly what I was looking for. Thank you Dawid.

Mejuto free answered 2 years ago

On the same spot, using datatable via attributes and need to seach, how to access to the row content via javascript?.

Thank you

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.9.0
  • Device: PC
  • Browser: Opera
  • OS: Windows
  • Provided sample code: No
  • Provided link: No