DataTable row selected link

DataTable row selected link

HamHam Posts: 1Questions: 0Answers: 0
edited December 2013 in General
Hi Allan !
First, sorry for my english. It is not my native language.

DataTables is a good plugin, thanks for it!

Today, I looked for a problem, but I didn't found anything. However I think that I almost found the solution.

I would like that each table row is clickable with a different link.

After many searches on your site, I tried the "fnRowCallback" function :

[code]
$(document).ready(function()
{
var myTable = $('#tabresult').dataTable(
{
"bProcessing": true,
"sAjaxSource": 'bigtable.php',

"fnRowCallback": function( nRow, aData, iDisplayIndex )
{
$('#tabresult tbody tr').click(function ()
{
document.location.href = "fiche_entrep2.php?Codebis=" + aData[4] , '_blank');
}
},

[/code]
I don't have my board, the link opens directly and the rows are not clickable.


After, I tried this :

[code]
$(document).ready(function()
{
$('#tabresult').delegate('tbody > tr ', 'click', function ()
{
window.location.href = ("fiche_entrep2.php?Codebis=" + aData[4] ) ;
});
var myTable = $('#tabresult').dataTable(
{
....
}
}
[/code]
The rows are clickable but "aData[4]" is undefined. "aData[4]" is the result of Ajax source.

Please, how can i make?
This discussion has been closed.