Hi, I am trying to add checkboxes to one of my views using the javascript example depicted here: https://docs.knack.com/docs/javascript-jquery-examples#add-checkboxes-to-a-table
but for some reason, they never seem to appear?
My view is view 115, here is the code:
// Function that adds checkboxes
var addCheckboxes = function (view) {
// Add the checkbox to to the header to select/unselect all
$("#" + view.key + “.kn-table thead tr”).prepend(
'<th><input type="checkbox"></th>'
);
$("#" + view.key + “.kn-table thead input”).change(function () {
$("." + view.key + ".kn-table tbody tr input").each(function () {
$(this).attr(
"checked",
$("#" + view.key + ".kn-table thead input").attr("checked") != undefined
);
});
});
// Add a checkbox to each row in the table body
$("#" + view.key + “.kn-table tbody tr”).each(function () {
$(this).prepend('<td><input type="checkbox"></td>');
});
};
// Add checkboxes to a specific table view (view_1). Replace view_1 with your view key
$(document).on(“knack-view-render.view_115”, function (event, view) {
addCheckboxes(view);
});
// Cycle through selected checkboxes. Use this in any code that needs to get the checked IDs
$("#view_115 tbody input[type=checkbox]:checked").each(function () {
// add code here to get record id or row value
var id = $(this).closest(“tr”).attr(“id”); // record id
});
Not sure if there is more of this example that needs changing
Thanks for any potential help