Skip to content

Commit

Permalink
Custom cell renderer.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdunkerley committed May 12, 2023
1 parent 2f403b5 commit c40ac88
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,17 @@ class TableVisualization extends Visualization {
return content
}

function cellRenderer(params) {
if (params.value === null) {
return '<span style="color:grey; font-style: italic;">Nothing</span>'
} else if (params.value === undefined) {
return ''
} else if (params.value === '') {
return '<span style="color:grey; font-style: italic;">Empty</span>'
}
return params.value.toString()
}

if (!this.tabElem) {
while (this.dom.firstChild) {
this.dom.removeChild(this.dom.lastChild)
Expand Down Expand Up @@ -133,14 +144,7 @@ class TableVisualization extends Visualization {
resizable: true,
minWidth: 25,
headerValueGetter: params => params.colDef.field,
cellRenderer: params => {
if (params.value === null) {
return '<span style="color:grey; font-style: italic;">Nothing</span>'
} else if (params.value === undefined) {
return ''
}
return params.value.toString()
},
cellRenderer: cellRenderer,
},
onColumnResized: e => this.lockColumnSize(e),
}
Expand Down

0 comments on commit c40ac88

Please sign in to comment.