Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

filter as you type in yii2 gridview

Tags:

php

gridview

yii2

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

like image 993
SO-user Avatar asked Feb 06 '15 10:02

SO-user


1 Answers

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.

like image 116
soju Avatar answered Sep 29 '22 14:09

soju