3

I am using Wenzhixin's bootstrap-table module. (http://bootstrap-table.wenzhixin.net.cn/)

When I load my bootstrap table with JSON, and the field is null like this: "MyField": null

I see a dash, or hyphen ( - ) inserted into the empty table cell. What's the best way to turn this off?

Edit: example here 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
        });

Thanks

Kevin UI
  • 187
  • 6
  • 14
  • Please post a **minimal working example** of your code (HTML/CSS/JS) in a [Snippet](https://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/). See [mcve] and [ask]. – vanburen Jul 20 '16 at 13:53
  • AFAIK, Bootstrap doesn't put in any hypens: http://codeply.com/go/GW489oWd5e – Carol Skelly Jul 20 '16 at 14:02
  • @ZimSystem No it does not. But Wenzhixin's bootstrap-table module does. – Romain Vincent Feb 27 '17 at 22:48

1 Answers1

5

You can use undefinedText option to do what you want, documentation here.

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

Example: https://jsfiddle.net/3k6qrswf/2/.

wenyi
  • 1,384
  • 8
  • 11