From 299eeaf9fee474fff8ae2726e3cc4e11c69d65ff Mon Sep 17 00:00:00 2001 From: Onkel Andy Date: Thu, 19 Dec 2024 14:00:10 +0100 Subject: [PATCH] http module: not only update responsive cell when hidden but also when visible --- .../http/webif/gstatic/datatables/datatables.defaults.js | 7 ++++++- modules/http/webif/gstatic/js/smarthomeng.js | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/http/webif/gstatic/datatables/datatables.defaults.js b/modules/http/webif/gstatic/datatables/datatables.defaults.js index 8161d4c1c1..a4727898f0 100755 --- a/modules/http/webif/gstatic/datatables/datatables.defaults.js +++ b/modules/http/webif/gstatic/datatables/datatables.defaults.js @@ -89,7 +89,12 @@ $(window).bind('datatables_defaults', function() { //setTimeout(function() { $(window).resize(); }, 2000); }, - responsive: {details: {type: 'column', renderer: $.fn.dataTable.Responsive.renderer.listHidden()}}, //makes it possible to update columns even if they are not shown as columns (but as collapsable items) + responsive: { + details: { + type: 'column', + renderer: $.fn.dataTable.Responsive.renderer.listHidden() + } + }, //makes it possible to update columns even if they are not shown as columns (but as collapsable items) preDrawCallback: function (oSettings) { // scroll diff --git a/modules/http/webif/gstatic/js/smarthomeng.js b/modules/http/webif/gstatic/js/smarthomeng.js index 7b1003109e..9293c18c51 100644 --- a/modules/http/webif/gstatic/js/smarthomeng.js +++ b/modules/http/webif/gstatic/js/smarthomeng.js @@ -115,7 +115,10 @@ function shngInsertText (id, text, table_id=null, highlight=0) { } // update datatable cell if (new_content) { - $('#' + table_id).DataTable().cell( $('#' + $.escapeSelector(id)) ).data(text); + let table = $('#' + table_id).DataTable(); + table.cell( $('#' + $.escapeSelector(id)) ).data(text).invalidate(); + table.responsive.rebuild(); + table.responsive.recalc(); console.log("Updating table because new cell data found: " + text + " for id " + id + ", old text: " + old_text); // $('#' + table_id).DataTable().draw(false); }