How do I make an entire row into an internal hyperlink?
How do I make an entire row into an internal hyperlink?
Good morning!
I am trying to make an entire row in DataTables into a hyperlink. I would like to use the data from the first cell [0] as a link for the rest of the cells (#qFormSearch.FormNo#.pdf) - the same link across all columns in one row.
Right now it is returning unique data for all 3 columns for the links, however, I'd like to use only the data from the first cell [0] for all three cells [0, 1, 2]
This is how I have it coded so far -
<div class="tab-pane" id="recordChanges">
<h3>Employee Record Changes</h3>
<cfoutput>
<table id="recordChangesTable" class="table table-striped table-bordered responsive">
<thead>
<tr>
<th>
Form
</th>
<th>
Form Name
</th>
<th>
Date Updated
</th>
</tr>
</thead>
<tbody>
<cfset toggle = 0>
<cfloop query="qFormSearch">
<cfset toggle = toggle + 1>
<cfif qFormSearch.RecordChange NEQ 0>
<tr>
<td>
#qFormSearch.FormNo#
</td>
<td>
#qFormSearch.FormName#
</td>
<td>
#DateFormat(qFormSearch.DateUpdated, "mm/dd/yyyy")#
</td>
</tr>
</cfif>
</cfloop>
</tbody>
</table>
</cfoutput>
</div>
$(document).ready( function() {
$('#recordChangesTable').dataTable( {
"sDom": '<"top"f><"bottom"><"clear">',
paging: false,
responsive: true,
"columnDefs": [ {
"targets": [0,1,2],
"render": function ( data, type, full, meta ) {
return '<a href="'+data+'.pdf">'+data+'</a>';
}
} ]
} );
} );
I would appreciate any help I can get here~
Answers
Please disregard the strange "a href" inclusions on line 25 and 28