S
S
Sergey Zbrodko2017-04-20 21:35:05
Yii
Sergey Zbrodko, 2017-04-20 21:35:05

How to link to row in Yii2 gridview?

How to make a link in the gridview to the entire row, so that when clicked, update would work?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Timofeev, 2017-04-20
@webinar

There are many options, including:

$('tr').on('click',function(){
$(this).find('a.someselector').click();
});

V
Valery, 2017-04-20
@supervaleha

On my knee I write:

$('#gridview tr td').on('click', function(e){
    e.preventDefault();
    var thr= $(this).closest('tr'); 
    location.href = '/some-module/some-controller/update?id=' + tr.data('key');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question