From fe31fd728865d43924b4773d87cb477a8ccc4826 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 8 Oct 2024 11:45:58 +0200 Subject: [PATCH] Bug 33484: Early return in add_filters if node does not exist Maybe we could even return early from kohaTable? Signed-off-by: Pedro Amorim Signed-off-by: Jonathan Druart Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index c560bd729b..5b7de46084 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -841,6 +841,8 @@ function _dt_on_visibility(add_filters, table_node, table_dt){ function _dt_add_filters(table_node, table_dt, filters_options = {}) { + if (!table_node.length) return; + $(table_node).find('thead tr:eq(1)').remove(); // Remove if one exists already $(table_node).find('thead tr').clone().appendTo( $(table_node).find('thead') ); -- 2.39.5