Yii Framework Forum

Howto maintain selected Tab after content refresh


(Kimmo Rihto) #1

My scenario: Have yii\bootstrap\Tabs as a container for two tabs, both containing a yii\grid\GridView. Say, first for Cats and second for Dogs. Both GridViews are constructed by associated dataProvider and filterModel. When I sort or filter my latter Tab/GridView "Dogs", the view is refreshed and Tab is focused to the first Tab, being "Cats".

My first wish: How to prevent the focus from moving to first (default) tab when sorting/filtering the latter GridView?

My second wish: How to get information about the selected Tab in PHP -side? I could save the selection in an PHP object, and retrieve for future (naturally sessionwise) use. I wish not involve Javascript, neither cookies.

My third wish: Please stick to Yii2.

Thanks in advance!