Skip to content

Commit

Permalink
Fix displaying of column with 0 value
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl committed Nov 17, 2018
1 parent 7030c9c commit 7fc6b64
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions views/scan.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
</form>

<script>
/* global JSONFormatter */
const JSONRender = value => new JSONFormatter.default(value).render()
const form = document.querySelector('#form')
form.addEventListener('submit', () => {
form.param.setAttribute('name', form.key.value)
Expand Down Expand Up @@ -226,7 +229,7 @@
for (const primaryKey of primaryKeys) {
const keyEl = $('<td class="preformatted"></td>')
rowEl.append(keyEl.append(new JSONFormatter.default(item[primaryKey]).render()))
rowEl.append(keyEl.append(JSONRender(item[primaryKey])))
}
for (const column of data.UniqueKeys) {
Expand All @@ -237,11 +240,11 @@
const columnEl = $('<td></td>')
const value = item[column]
const valueEl = value ? new JSONFormatter.default(value).render() : $('<span></span>')
let wrapperEl = null;
const valueEl = JSONRender(value)
let wrapperEl = null
if (Number.isInteger(value) && value >= 0) {
let dateValue;
let dateValue
try {
dateValue = new Date(value).toISOString()
} catch (error) {
Expand Down Expand Up @@ -293,7 +296,7 @@
.catch(error => {
alert('Error loading data: ' + error)
})
});
})
</script>

<div id="table-placeholder" class="text-center">Loading data...</div>
Expand Down

0 comments on commit 7fc6b64

Please sign in to comment.