来自data-url的引导表数据

时间:2014-11-19 04:24:42

标签: javascript node.js twitter-bootstrap html-table

我正在使用nodejs和jade以及bootstrap插件Bootstrap表。 我无法正常工作。

以下是jade中表格的一部分

h1 Reported Users
   table(data-toggle="table", data-url=reports)
      thead
         tr
           th(data-toggle="matched_uid") Reported User ID
           th(data-toggle="reported_name") Reported User Name
           th(data-toggle="email") Reported User Email
           th(data-toggle="message") Reported Offense(s)
           th(data-toggle="reporter_name") Reported By

表格加载如下:

enter image description here

当我查看浏览器控制台时,我认为data-url中的results正确加载:

enter image description here

我的data-url有效吗?有谁知道会出现什么问题? 请帮忙。提前谢谢!

1 个答案:

答案 0 :(得分:0)

试试这个;

数据-URL = “reports.json”

<thead>
    <tr>
        <th data-field="matched_uid">Reported User ID</th>
        <th data-field="reported_name">Reported User Name</th>
        <th data-field="email">Reported User Email</th>
        <th data-field="message">Reported Offense(s)</th>
        <th data-field="reporter_name">Reported By</th>
    </tr>
</thead>

你的json将是

[
{
    "matched_uid": "sample",
    "reported_name": "sample",
    "email": "sample",
    "message": "sample",
    "reporter_name":"sample"
},
{
    "matched_uid": "sample",
    "reported_name": "sample",
    "email": "sample",
    "message": "sample"
    "reporter_name":"sample"
},
{MORE},
{MORE},
{LAST}