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.
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.
Step 2
Add a CSS class of "check" to your action link.
Step 3
In the JavaScript tab of your page, add the following code.
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'>";
}
});
In case you want to know which record gets selected, you can add this to code a custom component:
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:
Was this page helpful?
Something wrong or missing on this page? Tell us.