Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap table, dashes / hyphens in empty cells

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

like image 217
Kevin UI Avatar asked May 17 '26 02:05

Kevin UI


1 Answers

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/.

like image 74
wenyi Avatar answered May 19 '26 23:05

wenyi