Bugzilla – Attachment 107657 Details for
Bug 26098
JS error on the fund list view if no fund displayed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26098: Fix JS error on the fund list view when no fund displayed
Bug-26098-Fix-JS-error-on-the-fund-list-view-when-.patch (text/plain), 7.60 KB, created by
Lucas Gass (lukeg)
on 2020-07-31 21:56:23 UTC
(
hide
)
Description:
Bug 26098: Fix JS error on the fund list view when no fund displayed
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2020-07-31 21:56:23 UTC
Size:
7.60 KB
patch
obsolete
>From 05ea1e362aabd93086a5340d553279f34fa171df Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >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 <lucas@bywatersolutions.com> >--- > .../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 4a6d561ec1..ce88e2865c 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 @@ > //<![CDATA[ > // > $(document).ready(function() { >- var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >- "fnDrawCallback": function ( oSettings ) { >- if ( oSettings.aiDisplay.length == 0 ) >- { >- return; >- } >+ [% IF budgets %] >+ var oTable = $("#budgeth").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "fnDrawCallback": function ( oSettings ) { >+ if ( oSettings.aiDisplay.length == 0 ) >+ { >+ return; >+ } > >- var nTrs = $('#budgeth tbody tr'); >- var iColspan = nTrs[0].getElementsByTagName('td').length; >- var sLastGroup = ""; >- for ( var i=0 ; i<nTrs.length ; i++ ) >- { >- var iDisplayIndex = oSettings._iDisplayStart + i; >- var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; >- if ( sGroup != sLastGroup ) >+ var nTrs = $('#budgeth tbody tr'); >+ var iColspan = nTrs[0].getElementsByTagName('td').length; >+ var sLastGroup = ""; >+ for ( var i=0 ; i<nTrs.length ; i++ ) > { >- var nGroup = document.createElement( 'tr' ); >- var nCell = document.createElement( 'td' ); >- nCell.colSpan = iColspan; >- nCell.className = "group"; >- nCell.innerHTML = sGroup; >- nGroup.appendChild( nCell ); >- nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >- sLastGroup = sGroup; >+ var iDisplayIndex = oSettings._iDisplayStart + i; >+ var sGroup = oSettings.aoData[ oSettings.aiDisplay[iDisplayIndex] ]._aData[1]; >+ if ( sGroup != sLastGroup ) >+ { >+ var nGroup = document.createElement( 'tr' ); >+ var nCell = document.createElement( 'td' ); >+ nCell.colSpan = iColspan; >+ nCell.className = "group"; >+ nCell.innerHTML = sGroup; >+ nGroup.appendChild( nCell ); >+ nTrs[i].parentNode.insertBefore( nGroup, nTrs[i] ); >+ sLastGroup = sGroup; >+ } > } >- } >- }, >- "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'); >- $("#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.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 26098
:
107566
|
107657
|
107847