/* remove user provided filter */ function removeFilter(clickedObject) { console.log("removeFilter") let inputObject = $(clickedObject) .parents("table") .find("input")[$(clickedObject).parents("th").index()] inputObject.value=""; // Clear input $(inputObject).trigger("change"); // trigger change event } /* add a text input to each column of a given datatable to allow filtering */ function addFilterFields(tableId){ $('#' + tableId + ' thead tr') .clone(true) .addClass('filters') .appendTo('#' + tableId + ' thead'); } /* callback function to activate filtering on a datatable */ function tableFiltering(api, table_anchor, exclude_columns=[]) { // For each column api .columns() .eq(0) .each(function (colIdx) { // Set the header cell to contain the input element var cell = $('#'+table_anchor+' .filters th').eq( $(api.column(colIdx).header()).index() ); if (exclude_columns.includes(colIdx)) { $(cell).html('
'); return; } $(cell).html('