Javascript: checkboxes in table but not in groups and totals

Hi all

I use javascipt to add checkboxes to a table (code from here: https://support.knack.com/hc/en-us/community/posts/222365967/comments/360009474971 (thanks 371330703392!)). It works well, except that the checkboxes are also displayed in the group and total row:

![](upload://ifSD3udB6wwMS6KamgoDGKEginx.png)

Is there a way to exclude the table row "kn-table-group" and "kn-table-totals"?

Thanks
Florian

Here my code:

// Function
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>');
});
}

//current date
var curday = function(sp){
today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1; //As January is 0.
var yyyy = today.getFullYear();

return (dd+sp+mm+sp+yyyy);
};

$(document).on('knack-view-render.view_1520', function (event, view) {

// Add update button
$('<div style="padding:10px 0px 15px"><button id="update" class="kn-button">Alle markierten ausbezahlen</button></div>').insertAfter('.view-header');

//Add checkboxes to table
addCheckboxes(view);

// Click event for the update button
$('#update').click(function () {

// Array of record IDs
var record_ids = [];

// Populate the record IDs using all checked rows
$('#' + view.key + ' tbody input[type=checkbox]:checked').each(function() {
record_ids.push($(this).closest('tr').attr('id')); // record id
});

// turn on the Knack wait spinner
Knack.showSpinner();

// Field(s) to update
var data = {
field_1207: curday('/'),
field_2052: 'ausbezahlt'
};

// set the delay to prevent hitting Knack API rate limit (milliseconds)
var myDelay = 100;

//call updateRecords function
$(function() {
updateRecords(record_ids.shift(), record_ids, data);
});

// use an ajax call to set the new value in knack for each checked record in the record ID array
var selectedRecords = record_ids.length + 1
function updateRecords(id, records, data) {
$.ajax({
url: 'https://api.knackhq.com/v1/objects/object_2/records/' + id,
type: 'PUT',
headers: {'X-Knack-Application-ID': '',
'X-Knack-REST-API-Key': ''},
data: data,
success: function(response) {
if (record_ids.length > 0) {
// every time a loop is made, the array is shifted by 1.
// if the array still has a length greater than 0, re-run another updateRecords loop
setTimeout(updateRecords(record_ids.shift(), record_ids, data), myDelay);
}
else {
alert('Updating ' + selectedRecords + ' records.' );
Knack.hideSpinner();
window.location.reload(true);
// Knack records are updated now
}
}
})
}
})
});