From 0aecefcbc8697e4da30c328bbb45029f7417ea03 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Tue, 21 Apr 2020 11:41:16 +0200 Subject: [PATCH] Add comments and simplify code Signed-off-by: DL6ER --- scripts/pi-hole/js/queries.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/queries.js b/scripts/pi-hole/js/queries.js index b62e2811..ef0d9209 100644 --- a/scripts/pi-hole/js/queries.js +++ b/scripts/pi-hole/js/queries.js @@ -519,9 +519,9 @@ $(document).ready(function() { $("#resetButton").click(function() { resetColumnsFilters(); + hideResetButton(); + // Trigger table update tableApi.draw(); - $("#resetButton").text(""); - $("#resetButton").hide(); }); var chkbox_data = localStorage.getItem("query_log_filter_chkbox"); @@ -543,7 +543,9 @@ function resetColumnsFilters() { tableApi.columns()[0].forEach(function(index) { tableApi.column(index).search("", true, true); }); - $("#resetButton").text(""); + // Clear filter reset button + hideResetButton(); + // Trigger table update tableApi.draw(); } @@ -556,3 +558,9 @@ function showResetButton(type, param) { } button.show(); } + +function hideResetButton() { + let button = $("#resetButton"); + button.text(""); + button.hide(); +}