O
O
Oversec2016-09-26 10:43:29
Yii
Oversec, 2016-09-26 10:43:29

Why doesn't the onclick of the GridView fire?

It is necessary that an action occurs in the GridView when a column is clicked, but for some reason I simply do not have the ooClick attribute on the a tag

[
                'attribute' => 'id',
                'label' => 'Выбрать водителя',
                'format' => 'html',
                'filter' => false,
                'value' => function ($model) {
                    $value = '<a onclick="parent.setDrivers('.$model->id.')" class="click btn btn-danger">Выбрать</a>';
                    return $value ;
                }
            ]

I tried with Html:a() too - same result. What is the problem? I tried to just write the text in Onclick, it just does not highlight the attribute

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2016-09-26
@webinar

try like this:

$onclick = "parent.setDrivers('".$model->id."')";
return Html::a('#','выбрать',['onclick'=>$onclick]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question