Rendering static file images in columns.
Rendering static file images in columns.

Hey people,
I wanted to know if it is possible to render an image from an static file in the columns through column rendering.
At first I have implemented it like this
{
targets: [3],
data: "image",
render: function(data, type, row) {
if(data == null){
return '<img src="{% static './img/none.jpg' %}" style="width: 120px;"/>';
} else {
return '<img src="'+data+'" style="width: 120px;"/>';
}
}
but the image none.jpg can't be rendered, when the data is equals null. How can I fix this?
Kind regards,
ynynloxx
This discussion has been closed.
Answers
Hi ynynloxx,
Could you let us know what the
src
URL of that none.jpg image is when you inspect it using the browser inspector tools?Thanks,
Sandy
Hey Sandy,
I didn't really understand what you mean, because I'm pretty new to html, css and javascript.
Did you mean the path of the none.jpg?
If so, the path is:
/Users/lo/PycharmProjects/lagerverwaltung-backend/lagerverwaltung/static/lagerverwaltung/img/none.jpg
Kind regards,
Yin-yin