Help - Trying to make each cell having its own hyperlink
Help - Trying to make each cell having its own hyperlink
Hello. I'm trying to use fnRender to change each cell value into ... VALUE
My problem is that I am specifying it in aoColumnDefs and only one target.. and have only the name of the row (aData[0])..
can anyone point me in the right direction? My ultimate goal is to click on each cell and popup a new page related to that column/row value
My current datatable follows:
[code] $( "#navTabs" ).tabs({
load: function(event, ui){
//if()
var oTable = $('#suportes').dataTable( {
// "sDom": '<"toolbar">frtip',
"aoColumnDefs": [{
"fnRender": function ( oObj, sVal ) {
console.log(oObj);
console.log(sVal);
return "" + sVal +' | ';
},
"aTargets": [1]
}],
"aaSorting": [[ 0, "desc" ]],
"iDisplayLength": 20,
"bProcessing": true,
"sAjaxSource": 'list1',
"bDeferRender": true
});
}
});
[/code]
My problem is that I am specifying it in aoColumnDefs and only one target.. and have only the name of the row (aData[0])..
can anyone point me in the right direction? My ultimate goal is to click on each cell and popup a new page related to that column/row value
My current datatable follows:
[code] $( "#navTabs" ).tabs({
load: function(event, ui){
//if()
var oTable = $('#suportes').dataTable( {
// "sDom": '<"toolbar">frtip',
"aoColumnDefs": [{
"fnRender": function ( oObj, sVal ) {
console.log(oObj);
console.log(sVal);
return "" + sVal +' | ';
},
"aTargets": [1]
}],
"aaSorting": [[ 0, "desc" ]],
"iDisplayLength": 20,
"bProcessing": true,
"sAjaxSource": 'list1',
"bDeferRender": true
});
}
});
[/code]
This discussion has been closed.
Replies
You may be able to do something like this, instead:
[code]"fnCreatedRow": function( nRow, aData, iDataIndex ) {
$('td:eq(4)', nRow).wrapInner('');
}[/code]
This would change all the contents of the 4th col so that they are links pointing at somewhere.php?where=WhateverWasInTheCell
If you needed to use a hidden ID or something like that in your URL then perhaps you could have a hidden column and use aData[0] when generating your link.
It would also be good to URLEncode the value that's being inserted into the link.
Cheers,
Ryan