I have followed the steps on implementing the Ajax Search With the GridView on the definitive guide but the search only works after keypress or mouse click. Below is my code snippet What am Missing in my code?


use yii\helpers\Html;

use yii\grid\GridView;

use yii\Widgets\Pjax;

/* @var $this yii\web\View */

/* @var $searchModel backend\models\CompaniesSearch */

/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Companies';

$this->params['breadcrumbs'][] = $this->title;


<div class="companies-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>


        <?= Html::a('Create Companies', ['create'], ['class' => 'btn btn-success']) ?>



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

    <?= GridView::widget([

        'dataProvider' => $dataProvider,

        'filterModel' => $searchModel,

        'columns' => [

            ['class' => 'yii\grid\SerialColumn'],







            ['class' => 'yii\grid\ActionColumn'],


    ]); ?>


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


You have to be more specific to get an answer. At a minimum you need to add an ID to the pjax widget, however, this most likely wont solve your problem.