Answer the question
In order to leave comments, you need to log in
How to implement row clickability in grid?
I need to implement so that view?id=$id opens when clicking on a row in the grid. An example I understood how to do is to receive data-key in it, as I understand it, because they fit the id.
Understanding how to redirect by link is not clear how to do it correctly, so I indicated the full path
$(document).ready(function(){
$('tr').on('click', function(){
var key = $('tr').data('key');
document.location.href = "http://crm/frontend/web/zakaz/view?id="+key;
});
});
Answer the question
In order to leave comments, you need to log in
$('tr')
are all tr. And you need the one that got the click. Therefore, instead $('tr').data('key');
of$(this).data('key');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question