Urls in column using javascript as data source
Urls in column using javascript as data source
dukestep
Posts: 1Questions: 1Answers: 0
Hi,
Fairly knew a this but was having an issue and thought I'd ask a question.
I have a column in my datatable that is filled with URLs. I am able to display the table with all my data intact but I can't for the life of me seem to be able to get the URLs to be clickable.
var dataSet = [
[ "Emploi", "Buffets Insère-Jeunes", "5188, Beaubien Est", "Montréal", "H1T 1W1", "514 593-7705",("http://www.traiteurbis.qc.ca/Bis/Bienvenue.html")]
];
$(document).ready(function() {
$('#example').DataTable( {
"language": {
"url": "js/French.json"
},
data: dataSet,
"columns": [
{ "title": "Domaine" },
{ "title": "Nom" },
{ "title": "Adresse" },
{ "title": "Ville" },
{ "title": "Code Postal" },
{ "title": "Telephone" },
{ "title": "Site Web" }
],
"columnDefs": [ {
"targets": [ 2, 4, 5, 6 ],
"orderable": false
} ],
} );
} );
I imagine there is a simple solution but I just can't seem to find it.
This discussion has been closed.
Answers
You can control how the content is displayed with the columndefs "render" option.
This page shows how to use the render option to return an anchor tag.
http://datatables.net/reference/option/columns.render