首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >插入HTML到bootstrap-table (wenzhixin)构建进度条

插入HTML到bootstrap-table (wenzhixin)构建进度条
EN

Stack Overflow用户
提问于 2018-07-06 01:36:58
回答 1查看 440关注 0票数 0

我有一个使用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>

或者,任何其他关于如何在我的表格中添加进度条的建议都将不胜感激!

EN

回答 1

Stack Overflow用户

发布于 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>"
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51197088

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档