YII 2.0 GridView update

2019-04-08 14:53发布

问题:

I've got problem with updating yiigridview via javascript. I'm trying to use it yii 1.1 way:

jQuery.fn.yiigridview.update('grid-id'); 

but this gets me the error: 'undefined is not a function' How to update the whole GridView widget (or only one row) in Yii framework 2.0 using javascript?

回答1:

I have found solution here http://www.yiiframework.com/wiki/655/how-to-use-gridview-with-ajax/ Using pjax:

$.pjax.reload({container:'#idofyourpjaxwidget'});


回答2:

You may also use Yii2 callback:

$("#your-grid-id").yiiGridView("applyFilter");


标签: gridview yii2