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:Share on twitter

Twitter

Share on reddit

Reddit

Share on linkedin

Linkedin

Share on facebook

Facebook

Share on email

Email