GridView selectable rows

Hello, in Yii 1 we had support for selectable rows in CGridView. I managed to make them clickable with something like this (in the CGridView properties):


    'selectableRows'=>1,

    'selectionChanged'=>'function(id){ location.href = "'.$this->createUrl('update', array('id'=>'')).'"+$.fn.yiiGridView.getSelection(id);}',	



I haven’t been able to find the selectable rows functionality in the GridView in Yii 2. Does it support it? How can I make the rows selectable? Thank you.

Same problem here. I can’t figure out how to make gridview rows selectable.

I’ve found a workaround, at least for selectableRows=1. I’m using it to update another gridview with a related id.




<?= GridView::widget([

    'dataProvider' => $dataProvider,

    'filterModel' => $searchModel,

    ...                  

    'rowOptions' => function ($model, $key, $index, $grid) {

                        return [

                            'id' => $model['id'],

                            'onclick' =>"js:$.pjax({"

                                . "container:'#another-grid-pjax',"

                                . "data:'AnothermodelSearch[relatedId]='+this.id"

                                . "});",

                        ];

    },

    ...

]);             



Why dont you use checkbox column and you can select multiple records and do any bulk action you want