This maybe simple, but cant seem to figure it out. Using jquery datatables how can I make each row clickable to just link to a normal page? So if someone moused over any of the row the whole row will hightlight and be clickable and link to whatever url I would want it to link to when clicked.
I've use the fnDrawCallback
parameter of the jQuery Datatables plugin to make it work. Here is my solution :
fnDrawCallback: function () { $('#datatable tbody tr').click(function () { // get position of the selected row var position = table.fnGetPosition(this) // value of the first column (can be hidden) var id = table.fnGetData(position)[0] // redirect document.location.href = '?q=node/6?id=' + id }) }
Hope this will help.
This did it for me using the row callback.
fnRowCallback: function(nRow, aData, iDisplayIndex, iDisplayIndexFull) { responsiveHelper.createExpandIcon(nRow); $(nRow).click(function() { document.location.href = 'www.google.com'; }); },
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With