@@ -, +, @@ - Select a tab to filter the table of saved reports to a particular report group. - Navigate away from the page - Return to the save reports page. The tab you previously selected should be selected again. - Restart your browser and return to the saved reports page. The tab should no longer be preselected. --- .../en/modules/reports/guided_reports_start.tt | 80 +++++++++++++--------- 1 file changed, 49 insertions(+), 31 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1376,6 +1376,9 @@ } $(document).ready(function(){ + + var activeTab = Cookies.get("sql_reports_activetab"); + $("body").on('click',".fetch_chart_data",function(){ if( [% unlimited_total || 0 | $raw %] > 1000 ){ if( confirm("Fetching full chart data for reports with many rows can cause performance issues. Are you sure you with to chart this report?") ){ @@ -1563,39 +1566,17 @@ }, }, columns_settings); - var rtabs = $("#tabs").tabs(); - rtabs.on("tabsactivate", function(e, ui) { - $("#subgroup_filter option").each(function() { - if($(this).val().length > 0) { - $(this).remove(); - } - }); - rtable.fnFilter('', 4); - rtable.fnFilter('', 5); - rtable.fnSetColumnVis(4, true); - rtable.fnSetColumnVis(5, true); - - var g_id = $(ui.newTab).children().attr('id'); - var g_name = $(ui.newTab).text(); - if ( g_name == _("All") ) { - g_id = ""; - g_name = ""; - } - - if (g_id && g_id.length > 0) { - rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false); - rtable.fnSetColumnVis(4, false); - for(var i in group_subgroups[g_id]) { - $("#subgroup_filter").append( - '' - ); - } - $("#subgroup_filter_block").show(); - } else { - $("#subgroup_filter_block").hide(); + var rtabs = $("#tabs").tabs({ + create: function( e, ui ){ + tabsInit( ui, rtable ); + }, + activate: function( e, ui ){ + tabsInit( ui, rtable ); } }); + if( activeTab ){ + $("#tabs").tabs("option","active", activeTab ); + } $("#subgroup_filter_block").hide(); $("#subgroup_filter").change(function() { @@ -1808,6 +1789,43 @@ }); }); + function tabsInit( ui, rtable ){ + var thisTab = ui.newTab ? ui.newTab : ui.tab; + var activeTab = thisTab.index(); + Cookies.set("sql_reports_activetab", activeTab ); + + $("#subgroup_filter option").each(function() { + if($(this).val().length > 0) { + $(this).remove(); + } + }); + rtable.fnFilter('', 4); + rtable.fnFilter('', 5); + rtable.fnSetColumnVis(4, true); + rtable.fnSetColumnVis(5, true); + + var g_id = $(ui.newTab).children().attr('id'); + var g_name = $(ui.newTab).text(); + if ( g_name == _("All") ) { + g_id = ""; + g_name = ""; + } + + if (g_id && g_id.length > 0) { + rtable.fnFilter('^' + g_name + '$', 4, true, true, true, false); + rtable.fnSetColumnVis(4, false); + for(var i in group_subgroups[g_id]) { + $("#subgroup_filter").append( + '' + ); + } + $("#subgroup_filter_block").show(); + } else { + $("#subgroup_filter_block").hide(); + } + } + function addColumn() { $("#availableColumns option:selected").clone().appendTo("#selectedColumns").attr("selected", "selected"); } --