Search column with hyperlink
Search column with hyperlink
n14463
Posts: 4Questions: 2Answers: 0
I didn't realize it will not be straight-forward. Can someone help me what do i need to do to search data in this hyperlink column? Please help
Below is my code
table = $('#tbl_samples_incomplete').DataTable({
"dom": 'frtip',
"responsive": true,
"lengthMenu": [[5, 10, 25, 50, -1], [5, 10, 25, 50, "All"]],
"select": true,
"paging": true,
"searching": true,
"filter": true,
"orderMulti": false,
"columns":
[
{ data: "Id", title: "Identifier", orderDataType: "dom-text", type: 'string' }
],
'columnDefs': [
{
"targets": [0],
"render": function (data, type, row, meta) {
if (type === 'display') {
var link = window.applicationBaseUrl + 't/test?sId=' + row.sId;
data = '<a href="' + link + '">' + data + '</a>';
return data;
}
}
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @n14463 ,
In the
columns.render
function, you're only returningdata
if the type is display. Have a return value for all other types, and if you want a search/filter type, have that too (type === 'filter'
).Cheers,
Colin
I see, let me try that
Sweet, works fine. Thanks Colin!