From c98fe734f5d4c113c643e8aaa6e66b26cbf88400 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 --- .../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 349c1cef4a..a520427f43 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.20.1