S
S
shanik2017-09-23 12:20:08
Yii
shanik, 2017-09-23 12:20:08

How to get id of selected row with type Radio in gridView Yii2?

radio is used in gridView

'columns' => [
                ['class' => 'yii\grid\RadioButtonColumn',

for the checkbox there is a code that returns the id of the selected row (it works for it):
var keys = $('#grid').yiiGridView('getSelectedRows');

Doesn't work for radio.
Is there a ready function for Radio?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-09-23
@shanik

Good afternoon.
Perhaps this will help you

[
    'class' => 'yii\grid\RadioButtonColumn',
    'radioOptions' => function($model, $keys, $index, $column){
        return [
                  'onchange' => "console.log($keys)"
               ];
     }
],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question