[英]How to render an image link in Datatable
I have the following table in a flask app.我在 flask 应用程序中有下表。 The first column is supposed to render a fully formed linked statement for example:
第一列应该呈现一个完整的链接语句,例如:
<a href ="https://www.website.com/i=2xyz2g" target="_blank"> <img src="/static/assets/img/abc.jpg" width="100" height="100"></a>
The data comes from a query: Table looks thus:数据来自查询: 表如下:
|img | Title |
-----------------------------------------------
| the <a> script above goes here | some text|
I would like to write the javascript to render the image/link.我想写 javascript 来渲染图像/链接。
<table id="table_id" class="display compact" style="width:100%"> <thead> <tr> {% for col in img_list_cols %} <th>{{col}}</th> {% endfor %} </tr> </thead> <tbody> {% for row in img_list_rows %} <tr> {% for row_data in row %} <td>{{row_data}}</td> {% endfor %} </tr> {% endfor %} </tbody> </table>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.