I am using pjax in my gridview to not append search query parameters in url. Here is my code for view
<?php Pjax::begin(['id' => 'pjax_one',
'timeout' => false,
'enablePushState' => false,
'clientOptions' => ['method' => 'get']
]) ?>
<?=
GridView::widget([... rest code is here]);
?>
<?php Pjax::end() ?>
In controller:
public function actionIndex() {
$searchModel = new UserSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
]);
}
This code working fine. But using this code browser back and forward buttons behave weird, it redirect to some other page instead of previous page.
If I do 'enablePushState' => true,
then it append query parameters to the url, which I do not want to append for the security reason.
Edit: This is happening when I am visiting any page using link or button available in gridview.
question from:
https://stackoverflow.com/questions/65949064/browser-back-and-forward-buttons-behave-weird-when-using-pjax-in-yii2 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…