From b24d51eccdb553076c2216d35d873f93ba38f28e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 30 Jul 2020 10:51:26 +0200 Subject: [PATCH] Bug 26098: Fix JS error on the fund list view when no fund displayed TypeError: this.data(...) is undefined in jquery.treetable.js Test plan: Go to the fund list view Select a filter that will return no result => With this patch applied there is no JS error in the console Signed-off-by: Lucas Gass Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart (cherry picked from commit b6cb3c2ba54c0e10c27f37a0d2dec4f2875f2ddd) Signed-off-by: Lucas Gass (cherry picked from commit 052d5d5568190396d096df528bdc5aed7558e38c) Signed-off-by: Aleisha Amohia --- .../prog/en/modules/admin/aqbudgets.tt | 126 +++++++++--------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt index 27e80a1235..02a63d006e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tt @@ -620,73 +620,75 @@ //tr<"bottom pager"ip>', - 'bSort': true, - 'aaSortingFixed': [[ 1, 'asc' ]], - 'bPaginate': false, - "bAutoWidth": false - })); - - $(oTable).treetable({ - expandable: true - }); - $(oTable).treetable('expandAll'); - $("#expand_all").click(function(e){ - e.preventDefault(); + }, + "footerCallback": function ( row, data, start, end, display ) { + var api = this.api(), data; + footer_column_sum( api, [ 4, 6, 8, 10 ], 2 ); + }, + "aoColumnDefs": [ + { "bVisible": false, "aTargets": [ 0, 1 ] }, + { "bSortable": false, "aTargets": ["_all"] } + ], + 'dom': '<"top pager"ilpf>tr<"bottom pager"ip>', + 'bSort': true, + 'aaSortingFixed': [[ 1, 'asc' ]], + 'bPaginate': false, + "bAutoWidth": false + })); + + $(oTable).treetable({ + expandable: true + }); $(oTable).treetable('expandAll'); - }); - $("#collapse_all").click(function(e){ - e.preventDefault(); - $(oTable).treetable('collapseAll'); - }); - - [% UNLESS budget_period_id %] - $("#hide_inactive").click(function(e){ - e.preventDefault(); - oTable.fnFilter( 1, 0 ); // Show only active=1 - }); - $("#show_inactive").click(function(e){ - e.preventDefault(); - oTable.fnFilter( '', 0 ); - }); - $("#hide_inactive").click(); + $("#expand_all").click(function(e){ + e.preventDefault(); + $(oTable).treetable('expandAll'); + }); + $("#collapse_all").click(function(e){ + e.preventDefault(); + $(oTable).treetable('collapseAll'); + }); + + [% UNLESS budget_period_id %] + $("#hide_inactive").click(function(e){ + e.preventDefault(); + oTable.fnFilter( 1, 0 ); // Show only active=1 + }); + $("#show_inactive").click(function(e){ + e.preventDefault(); + oTable.fnFilter( '', 0 ); + }); + $("#hide_inactive").click(); + [% END %] + oTable.fnAddFilters("filter", 750); [% END %] - oTable.fnAddFilters("filter", 750); $("#filterbutton").click(function() { $("#fundfilters").slideToggle(0); -- 2.39.5