tomsea
(tomsea)
April 23, 2015, 8:28pm
1
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.
mogul
(Rogerio Takejame)
October 14, 2015, 4:58am
2
Same problem here. I can’t figure out how to make gridview rows selectable.
mogul
(Rogerio Takejame)
October 19, 2015, 1:52am
3
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"
. "});",
];
},
...
]);
tomsea:
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.
Why dont you use checkbox column and you can select multiple records and do any bulk action you want