const tables_to_print = [ { title: 'Allergien', table: i_allergies }, { title: 'Aktuelle Medikamente', table: i_current_medication }, { title: 'Vergangene Medikamente', table: i_past_medication }, { title: 'Aktuelle Diagnose', table: i_current_problems }, { title: 'Vergangene Diagnosen', table: i_past_problems }, { title: 'Familienanamnese', table: i_family_problems }, { title: 'Operationen', table: i_procedures }, { title: 'Lebensstil', table: i_socialhistory }, { title: 'Durchgeführte Tests', table: i_results }, { title: 'Laborwerte', table: i_vitalsigns }, ]; document.querySelector(".btn-print").addEventListener("click", function(){ // need to load all tables into the DOM expandAll(); printTables(); }); function printTables() { const print_area = document.createElement("div"); // Static header and patient information const header_html = `
Adresse: Am Schulweg 5, Hainfeld, 3100, AUT
Identifikationsnummer:0000121150
`; // Append the header to print_area print_area.innerHTML += header_html; // Loop through tables and add them to print_area for (const table_to_print of tables_to_print) { table_to_print.table.redraw(true); // Ensure table is redrawn const title_html = "