How to display local image in cell
How to display local image in cell
I have read a # of entries regarding pulling and displaying an image from a database. I am looking for a simple example of displaying an image that is in the local folder. Below is an example of what I have tried without success. I read about Render but don't feel that this is required since it is a local image, not pulled from the database and their is no logic necessary for deciding what image to display. The image would be the same for all rows.
"columns": [
{"render": function (data, type, full, meta) {
return '<img src="Content/css/images/sort_asc.png>';}
},
{"image": '<img src="Content/css/images/sort_asc.png>'},
{ '<img src="Content/css/images/sort_asc.png>"' },
{ "data": "MatrixName" },
{ "data": "CodeValueAbbreviation" },
{ "data": "StandardAbbreviation" },
{ "data": "ElementBusinessTerm" },
{ "data": "StatusCode" },
{ "data": "UsageNotes" }
],
Thanks for your help.
This question has an accepted answers - jump to answer
Answers
You will need to use
columns.render
. What data property name is the information about the image in?Allan
Sorry. I missed that part originally. If it is static and not row dependent - use
columns.defaultContent
and just set it to be an image tag. Usedata: null
to tell DataTables don't to try and read any data.Allan