Kevin UI Kevin UI - 1 year ago 166
JSON Question

Bootstrap table, dashes in empty cells

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

Bootstrap puts a dash or hyphen "-" in the empty table cell. What's the best way to turn this off/avoid this?

I am considering converting the nulls into empty strings, but I'd like to avoid that if possible.

Edit: example here

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

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

data: testData


Answer Source

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

    undefinedText: 'n/a',
    data: testData


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download