数据小部件过滤数据Yii2

I use Data widget with pjux and need to sort my date. I tried use this http://www.yiiframework.com/doc-2.0/guide-output-data-widgets.html. But have troubles with filtering. My SiteController

$PostView = Posts::findOne($id);
$model = new Comments();

if ($model->load(Yii::$app->request->post()) && $model->validate()) {
    $model->user_id = Yii::$app->user->getId();
    $model->post_id = $id;

    if ($model->save()):
        $model = new Comments();
        Yii::$app->session->setFlash('success', "OK");
    else: Yii::$app->session->setFlash('error', "NOT");
        Yii::error('Some error');
        return $this->refresh();
    endif;

} else {
    $searchModel = new CommentsSearch();
    $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
    return $this->render('view', [
        'PostView' => $PostView,
        'searchModel' => $searchModel,
        'dataProvider' => $dataProvider,
        'model' => $model,
    ]);
}

In my Search controller

$query->andFilterWhere([
        'id' => $this->id,
        'post_id' => $this->post_id,
        'user_id' => $this->user_id,
        'created_at' => $this->created_at,
        'updated_at' => $this->updated_at,
    ]);

$query->andFilterWhere(['like', 'comment', $this->comment]);

return $dataProvider;

In view:

<?php Pjax::begin(['id' => 'comments']) ?>
<?= GridView::widget([
    'dataProvider' => $dataProvider,
    'filterModel' => $searchModel,
    'columns' => [
        ['class' => 'yii\grid\SerialColumn'],
        'post_id',
        'comment:ntext',
    ],
]); ?>
<?php Pjax::end() ?>

Also, if i change 'post_id' => $this->post_id, on 'post_id' => '1', filtering working. Help please.

Maybe you forgot to include your attributes into "safe" array in $model->rules() method.

[['post_id'], 'safe'],

Try to

var_dump($this->post_id);

after "$this->load($params)" in your search model to see what's there.