One hyperlink displays; one doesn't
One hyperlink displays; one doesn't
MontereyDean
Posts: 13Questions: 1Answers: 0
Hi! I'm using the server-side processing script, mysql and ajax. On the following page, the page link doesn't display as a link; but, the file link shows a link:
http://www.mcwd.org/service_forms.html
This is the code I'm using for those two columns:
"columnDefs": [ {
"targets": 2,
"render": function ( data, type, full, meta ) {
return '<a href=\"'+data+'\" target=\"_blank\">Visit</a>';
},
"targets": 4,
"render": function ( data, type, full, meta ) {
return '<a href=\"/'+data+'\" target=\"_blank\">View</a>';
}
} ]
Any idea why one works and one doesn't?
This discussion has been closed.
Replies
Or, if I remove target 4, then target 2 works. Is it possible to have only 1 hyperlink per table?
On the page you link to (but not the code above) you have two different
columnDefs
properties in the initialisation object. You can't do that I'm afraid - you can only have a singlecolumnDefs
array. But simply give it multiple objects to define multiple targets. You can have as many columns with links as you want!Allan
Yes, sorry. I tried two columnDefs when the above wouldn't work. Is there anyone who can tell me how to "simply give it multiple objects to define multiple targets"? Or point me to a page that shows me how?
What I meant was you would do something like:
where
object 1
andobject 2
are the column definition objects (with their owntargets
value).Allan
Based on your code above you would have something like:
Allan
Oh, my, gosh! Thank you so much. I was missing "}, {" between the two targets.