Topic: Datatables async button eventlisteners

jamie priority asked 2 years ago

In my datatable i get the data from a json api. i want to include an edit button on the table.

how do i add the event listener to the asyncTable const asyncTable = new mdb.Datatable( document.getElementById('datatable'), { columns }, //other bits of code .then((data) => { console.log(data) asyncTable.update({ rows: => ({ ...posts, postid:, createddate: posts.createddate, title: posts.title, description: posts.description, publisheddate: posts.publisheddate,
edit: ``<button class="edit-btn btn btn-outline-primary btn-floating btn-sm" data-mdb-id="${}"><i class="fa fa-marker"></i></button>``, })),

Michał Duszak staff answered 2 years ago

Here is an example on adding buttons to certain rows, and attaching an event listener afterwards:

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: pc
  • Browser: chrome
  • OS: win11
  • Provided sample code: No
  • Provided link: No