How to Add Checkboxes to Your Table and Add Logic to Them!

The following is a solution for adding checkboxes with logic to your table. As well as a solution to know which record gets selected.

  • Not yet re-checked
  • Classic builder

Moved from our previous help site and not yet re-checked against the current product. Last edited Sep 20, 2024.

Screenshot for “How to Add Checkboxes to Your Table and Add Logic to Them!”

The following is a solution for adding checkboxes with logic to your table. As well as a solution to know which record gets selected.

Step 1

Add an action link to your table.

Screenshot for “How to Add Checkboxes to Your Table and Add Logic to Them!”

Step 2

Add a CSS class of "check" to your action link.

Screenshot for “How to Add Checkboxes to Your Table and Add Logic to Them!”

Step 3

In the JavaScript tab of your page, add the following code.

Text
TB.render('component_3', function(data) {
    var elems = document.getElementsByClassName("check");

    for (let i = 1; i < elems.length; i++) {
        elems[i].innerHTML = "<input type='checkbox'>";
    }
});
Screenshot for “How to Add Checkboxes to Your Table and Add Logic to Them!”
Screenshot for “How to Add Checkboxes to Your Table and Add Logic to Them!”

In case you want to know which record gets selected, you can add this to code a custom component:

html
var checkboxes = document.getElementsByClassName("check");
 for (let i = 0; i < checkboxes.length; i++) {
        if(checkboxes[i].checked){
          // Do your logic
          //If you want to get ID of each record you should pass it in the checkbox innerHTML
        }     
}

Original Community Post:

How to add checkboxes to your table and add logic to them! - Community Discussions / Tips and Tricks - Tadabase Community

Was this page helpful?

Something wrong or missing on this page? Tell us.