H
H
hollanditkzn2017-04-04 10:43:28
Yii
hollanditkzn, 2017-04-04 10:43:28

How to make row transition in gridview?

I can't figure out if it's possible to make it possible to remove this button

[
            'class' => 'yii\grid\ActionColumn',
            'template' => '{view}',
            'buttons' => [
                'view' => function ($url,$model) {
                    return Html::a(
                    '<button class = "btn btn-primary">Открыть</button>', 
                    $url);
                },
            ],

And make it so that when you click on the line, it goes to the view page, as is done in the mail, when you click on the letter itself, it opens the full view of the letter.
I have a final guess, but it most likely does not fit if you insert value Hrml:: a into the string
Or is it impossible to implement it in the grid?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2017-04-04
@hollanditkzn

is it possible to make it possible to remove this button

Yes
[
            'class' => 'yii\grid\ActionColumn',
            'template' => '',

but in this case it's easier to just delete the entire yii\grid\ActionColumn.
write js that will catch a click on tr and redirect where necessary, for example:
$('#grid tr').on('click',function(){
var id = $(this).data('key');
var url = "http://mysite.com/controller/view?id=";
$(location).attr('href',url+id);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question