Skip to content

Commit

Permalink
http module: not only update responsive cell when hidden but also whe…
Browse files Browse the repository at this point in the history
…n visible
  • Loading branch information
onkelandy committed Dec 19, 2024
1 parent 3886e75 commit 299eeaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion modules/http/webif/gstatic/datatables/datatables.defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion modules/http/webif/gstatic/js/smarthomeng.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 299eeaf

Please sign in to comment.