symfony2admingenerator / GeneratorBundle

Admingenerator for Symfony. Parse YAML files to build customized backend.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

active tab on page reload

snuffer82 opened this issue · comments

hi all,

I have a problem that I can not solve: if I refresh (or save) the page the tab is reset to default setting (tab-1). How to keep the current tab active on page reload?

active_tab

thanks!!
paolo

solved!
I put this code into index.html.twig

<script type="text/javascript"> $(document).ready(function(){ $('a[data-toggle="tab"]').on('show.bs.tab', function(e) { localStorage.setItem('activeTab', $(e.target).attr('href')); }); var activeTab = localStorage.getItem('activeTab'); if(activeTab){ $('#myTab a[href="' + activeTab + '"]').tab('show'); } }); </script>

Paolo