Display null in SQL table cell (#7463)

* Display null if cell in table is empty

* Add null

* re-indent
This commit is contained in:
Qi Shu 2019-04-13 12:05:14 -07:00 committed by Fangjin Yang
parent c57e62bcd6
commit 233d485ad0
2 changed files with 17 additions and 1 deletions

View File

@ -36,6 +36,10 @@
.ReactTable { .ReactTable {
flex: 1; flex: 1;
.null-table-cell {
font-style: italic;
}
} }
} }

View File

@ -195,7 +195,19 @@ export class SqlView extends React.Component<SqlViewProps, SqlViewState> {
loading={loading} loading={loading}
noDataText={!loading && result && !result.rows.length ? 'No results' : (error || '')} noDataText={!loading && result && !result.rows.length ? 'No results' : (error || '')}
sortable={false} sortable={false}
columns={(result ? result.header : []).map((h: any, i) => ({ Header: h, accessor: String(i) }))} columns={
(result ? result.header : []).map((h: any, i) => {
return {
Header: h,
accessor: String(i),
Cell: row => {
const value = row.value;
if (value === '' || value === null) return <span className="null-table-cell">null</span>;
return value;
}
};
})
}
defaultPageSize={10} defaultPageSize={10}
className="-striped -highlight" className="-striped -highlight"
/>; />;