Yii2 how use GridView filters with Pjax and Modal

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:


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'],





    ]); ?>

    <?php Pjax::end(); ?>


Any help!

Did you fix this ?

what is the solution for this question?

The code above works, so it already self-answered:-)

The most important is to set your own custom ID into

Pjax::begin(['id' => 'yourId'])

Using GridView inside bootstrap modal is, however a special case,in which pushState and replaceState should also be disabled to avoid undesired page reloading:


   'id' => 'yourId',

   'enablePushState' => false,

   'enableReplaceState' => false,


Optionally, take a look at enhanced version of GridView component by Kartik and it’s pjax settings.