How to render specific columns as img ?
How to render specific columns as img ?
ziv@kpmbro.com
Posts: 73Questions: 28Answers: 4
Hello
I am having some columns in my table that is a url link to an img, so i render them different,
the problem begin when i target more than one column, what actually happening is that the last column targeted set his data to all previous columns.
my code:
$('#extra_table').DataTable({
"scrollX": true,
"scrollY": true,
"paging": false,
"bFilter": false,
"columnDefs": [{
"targets": [3,4,5,6],
"data": "description",
"render": function(data, type, full, meta) {
var str = $(data).text();
var final_html = '<img src="' + str + '"/>';
return final_html;
}
}]
});
What am I doing wrong?
thanks
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You are setting
data": "description",
for columns 3, 4, 5 and 6. They will all show thedescription
data.Do you actually need that property? Where is the data for the table coming from?
Allan
Thanks Allen, that was it.