title: GridView search filters don't appear Yii2
body: <p>I've created GridView widget in my view with following params: </p>
  
  <pre><code>&lt;?= GridView::widget([
          'dataProvider' =&gt; $provider,
          'filterModel' =&gt; $searchModel,
          'summary' =&gt; '&lt;br&gt;',
          'showOnEmpty' =&gt; false,
          'columns' =&gt; [
              [
                  'attribute' =&gt; 'name',
                  'value' =&gt; function ($model) {
                      return substr($model-&gt;name, 0, 50);
                  },
              ],
              [
                  'label' =&gt; "Ім'я користувача",
                  'attribute' =&gt; "user.name",
                  'value' =&gt; function ($model) {
                      return substr($model-&gt;user-&gt;name, 0, 50);
                  },
              ],
              [
                  'label' =&gt; 'Назва предмету',
                  'attribute' =&gt; "subjects.name",
                  'value' =&gt; function ($model) {
                      return substr($model-&gt;subjects-&gt;name, 0, 50);
                  },
              ],
              [
                  'class' =&gt; 'yii\grid\ActionColumn',
                  'template' =&gt; '{view} {delete}'
              ]
          ],
      ]) ?&gt;
  </code></pre>
  
  <p>My controller has such code:</p>
  
  <pre><code>        $searchModel = new DocumentsSearch();
      $provider = $searchModel-&gt;search(Yii::$app-&gt;request-&gt;queryParams);
  
      return $this-&gt;render('index', [
          'provider' =&gt; $provider,
          'searchModel' =&gt; $searchModel
      ]);
  </code></pre>
  
  <p>Also I'm using DocumentSearch model that has following description:</p>
  
  <pre><code>class DocumentsSearch extends Documents
  {
      public $username;
      public $subject_name;
  
      public function rules()
      {
          return [
              [['username', 'subject_name'], 'safe']
          ];
      }
  
      public function search($params)
      {
          $query = Documents::find()
              -&gt;joinWith(['user', 'subjects']);
  
          $dataProvider = new ActiveDataProvider([
              'query' =&gt; $query,
              'pagination' =&gt; [
              'pagesize' =&gt; 30,
          ],
      ]);
  
      $dataProvider-&gt;sort-&gt;attributes['user.name'] = [
          'asc' =&gt; ['user.name' =&gt; SORT_ASC],
          'desc' =&gt; ['user.name' =&gt; SORT_DESC],
      ];
  
      $dataProvider-&gt;sort-&gt;attributes['subjects.name'] = [
          'asc' =&gt; ['subjects.name' =&gt; SORT_ASC],
          'desc' =&gt; ['subjects.name' =&gt; SORT_DESC],
      ];
  
  
      if (!($this-&gt;load($params) &amp;&amp; $this-&gt;validate())) {
          return $dataProvider;
      }
  
  
      $query-&gt;andWhere('user.name LIKE "%' . $this-&gt;name . '%" ');
  
      $query-&gt;andWhere('user.name LIKE "%' . $this-&gt;username . '%" ');
  
      $query-&gt;andWhere('subjects.name LIKE "%' . $this-&gt;subject_name . '%" ');
  
  
      return $dataProvider;
  
      }
  
  }
  </code></pre>
  
  <p>DocumentSearch extends Document model. And I've next relations:</p>
  
  <pre><code>public function getUser()
  {
      return $this-&gt;hasOne(User::className(), ['id' =&gt; 'owner_id']);
  }
  
  public function getSubjects()
  {
      return $this-&gt;hasOne(Subjects::className(), ['id' =&gt; 'subject_id']);
  }
  </code></pre>
  
  <p>All these things give me next result:</p>
  
  <p><a href="https://i.stack.imgur.com/17FkA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/17FkA.png" alt="ScreenSh"></a></p>
  
  <p>Before asking I've tried to create inputs by myself using <code>filter</code> param for each column like <code>'filter'=&gt;Html::input('text','DocumentSearch[subjects.name]')</code>
  It triggers JS to send the request but <code>if (!($this-&gt;load($params) &amp;&amp; $this-&gt;validate()))</code> method obvious returns false.</p>