How to only include a link if the link exists
How to only include a link if the link exists
https://redroosterdesign.com/ttuhsc-design-library/directory-1-v2.html:
Description of problem: I have figured out how to pull the url from a currently hidden column that is passed to the first name column. The first person in this list does not have the url data, but the hyperlink is showing anyway, it's just an empty url. I would like to figure out how to only show that hyperlink on the first name if the data in the url exists.
I'm using this columnDefs to pull the url:
"targets": [0],
"data": "url",
"render": function(data, type, full, meta){
return '<a href='+full.url+'>'+data+'</a>';
This question has an accepted answers - jump to answer
Answers
Add an
if
condition:Allan
You are a life saver! Worked like a charm. Thank you!