String does not appear in column
The code is simple. What I want to do is have the string '---' appear if fileName is empty and display fileName if fileName contains any content.
What happens is that fileName does appear if fileName is a non-empty string, but if fileName is empty, nothing appears (instead of '---')
Data Table version 7.5 React 17.02
const columns = [
{
name: "Filename",
selector: "fileName",
format: (d) => (d.fileName === '' ? ' --- ' : d.fileName),
width: "160px",
cell: Cell("fileName"),
}
]
Cell supersedes format. You'll want to use one or the other.
I can't seem to get it to accept both a conditional and tooltips. I tried something like this:
format: (d) => (d.fileName === '' ? ' --- ' : <span style={{whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis"}} title={d.filename}>{d.filename}</span>),
Try the cell property. Format is meant for simpler use cases.
I ended up using format:
format: (d) => (d.fileName === '' ? ' --- ' : <span style={{whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis"}} title={d.fileName}>{d.fileName}</span>),