I’m trying to get gridview to use the post method instead of get. When i change it to post, and seach a column, it redirects to my home page, not sure whats going on. Here is what i have so far.
in my view
<div class="report-index-1">
<?php Pjax::begin(['id' => 'report1',
'timeout' => false,
'enablePushState' => false,
'clientOptions' => ['method' => 'POST']]);
?>
<?= GridView::widget(
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
... gridview configuration...
]); ?>
<?php Pjax::end(); ?>
</div>
<div class="report-index-2">
<?php Pjax::begin(['id' => 'report2',
'timeout' => false,
'enablePushState' => false,
'clientOptions' => ['method' => 'POST']]);
?>
<?= GridView::widget(
'dataProvider' => $dataProviderONE,
'filterModel' => $searchModelONE,
... gridview configuration...
]); ?>
<?php Pjax::end(); ?>
</div>
in my controller, i changed Yii::$app->request->queryParams
to Yii::$app->request->post()
public function actionIndex()
{
$searchModel = new ReportQuery();
$dataProvider = $searchModel->search(Yii::$app->request->post());
$searchModelONE = new ReportOneQuery();
$dataProviderONE = $searchModelONE->search(Yii::$app->request->post());
return $this->render('index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider
'searchModelONE' => $searchModelONE,
'dataProviderONE' => $dataProviderONE
]);
}