If you’re using Yii2 Gridview with tabs and notice that when the user filters the results, posting the page goes to the wrong tab.

This solution worked great for me:
$(document).ready(function() {
$('a[data-toggle=\"tab\"]').on('show.bs.tab', function (e) {
localStorage.setItem('lastTab', $(this).attr('href'));
});
var lastTab = localStorage.getItem('lastTab');
if (lastTab) {
$('[href=\"' + lastTab + '\"]').tab('show');
}
});

via Maintain Bootstrap Tab on Yii2 Gridview Page Changing

Support this site, share this page:Tweet about this on Twitter

Twitter

Share on Reddit

Reddit

Share on LinkedIn

Linkedin

Share on Facebook

Facebook

Email this to someone

email