[Working] Juqery datatable row clickable

I have used jquery datatable in all my applications. One of them I need to make a whole clickable, but did a lot of research and after spending couple of hours didn’t get proper solution. Then I just tweaked and it worked fine for me.

I just added link to table tr and then make on tr click able to navigate where I want.

Here the code


 "initComplete": function() {
                    $('#tbl-mek-upcoming-jobs tbody').on('click', 'tr', function () {
                        window.location.href = $(this).attr('href');
                    });
                },
"rowCallback": function(nRow, data) {
                    $(nRow).attr("href", "/Mechanic/Home/JobDetails?id=" + data[0] + "");
                },

Hope that will work for you guys as well.

cheers..

Posted by | View Post | View Group