SO-user
SO-user

Reputation: 1456

filter as you type in yii2 gridview

I need to filter the gridview as you type. By default it filters only when the enter key is pressed.

Upvotes: 6

Views: 3279

Answers (1)

soju
soju

Reputation: 25312

You should handle this using your own js, e.g. :

$this->registerJs('$("body").on("keyup.yiiGridView", "#grid-id .filters input", function(){
    $("#grid-id").yiiGridView("applyFilter");
})', \yii\web\View::POS_READY);

You should of course replace grid-id with appropriate id.

Upvotes: 5

Related Questions