引导表,空单元格中的短划线/连字符

时间:2016-07-20 13:43:23

标签: json twitter-bootstrap null bootstrap-table tablecell

我正在使用Wenzhixin的bootstrap-table模块。 (http://bootstrap-table.wenzhixin.net.cn/

当我使用JSON加载我的引导程序表时,该字段为null,如下所示: " MyField":null

我看到一个短划线或连字符( - )插入到空表格单元格中。什么是解决这个问题的最好办法?

编辑:此处示例https://jsfiddle.net/3k6qrswf/1/

    <table id="table" class="table">
  <thead>
    <tr>
      <th data-field="BookTitle">Title</th>
    </tr>
  </thead>             
</table>

    var testData = [
    {"BookTitle": "abc"},
  {"BookTitle": "def"},
  {"BookTitle": null}
];

$('#table').bootstrapTable({
            data: testData
        });

由于

1 个答案:

答案 0 :(得分:3)

您可以使用undefinedText选项执行您想要的操作,文档here

$('#table').bootstrapTable({
    undefinedText: 'n/a',
    data: testData
});

示例:https://jsfiddle.net/3k6qrswf/2/