I’m trying to use GridView filters in Modal using Pjax but I can’t do it successfully the modal show GridView and the pagination in this GridView work normally then when I trying to use filters nothing happened and there is not request sent to controller.
Below code of my controller:
/**
* List all system users
* @return all users as ajax
*/
public function actionList()
{
$searchModel = new UsersSearch();
$dataProvider = $searchModel->search(Yii::$app->request->getQueryParams());
return $this->renderAjax('list', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
Below code of my view:
<?php
use yii\helpers\Html;
use yii\grid\GridView;
use yii\helpers\Url;
use yii\widgets\Pjax;
/* @var $this yii\web\View */
/* @var $searchModel app\models\UsersSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */
?>
<div class="users-list">
<?php Pjax::begin(['id'=>'pjax-users']); ?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'filterModel' => $searchModel,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'username',
'full_name',
'email:email',
],
]); ?>
<?php Pjax::end(); ?>
</div>
Any help!