filter as you type in yii2 gridview

2019-04-08 22:32发布

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

1条回答
走好不送
2楼-- · 2019-04-08 22:53

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.

查看更多
登录 后发表回答