我有一个使用table from data method生成的带有引导数据库表的表。
有没有什么方法可以把html插入到json数据数组的单元格中?
html:
<table
id="bootstrap-table"
data-pagination="true"
data-show-export="true"
>
<thead>
<tr>
<th data-field="id" data-switchable="false">Delivery #</th>
<th data-field="created_at" data-sortable="true">Created</th>
<th data-field="progress" data-sortable="true">Progress</th>
</tr>
</thead>
</table>
js:
//bs-table options
$table.bootstrapTable({
data: dataJson,
});
我的目标是将以下HTML注入进度数据字段,同时以某种方式使用其中的百分比值来设置进度条宽度。
<div class="progress">
<div class="progress-bar" style="width:100%"></div>
</div>
或者,任何其他关于如何在我的表格中添加进度条的建议都将不胜感激!
发布于 2018-07-06 04:58:18
所以事实证明,JSON中包含的任何代码都呈现为HTML...所以让它工作起来非常简单!即
{
"id":460000000,
"progress":"<div class=\"progress progress-margin\"><div class=\"progress-bar\" style=\"width:61%\"><\/div><\/div>"
}
https://stackoverflow.com/questions/51197088
复制相似问题