This commit is contained in:
Chen Asraf
2017-12-30 19:18:27 +02:00
parent 3be3b991bc
commit f27c5c83b4
3 changed files with 12 additions and 5 deletions

View File

@@ -20,7 +20,7 @@
Learn how to configure a non-root public URL by running `npm run build`.
-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<title>React App</title>
<title>JSON Redar</title>
</head>
<body>
<noscript>

View File

@@ -51,7 +51,7 @@ class DataTable extends React.Component<I.Props, I.State> {
}
parsed = parsed.map((row: any, i: number) => {
row._id = row._id || row.id || 'row-' + i
row._id = row._id || row.id || i
return row
})

View File

@@ -71,9 +71,16 @@ class KeyList extends React.Component<I.IProps, I.IState> {
}
private columnListFromRow(row: any) {
return ['_id'].concat(Object.keys(row).filter((k: string) => (
k.toLowerCase() !== 'id' && k.toLowerCase() !== '_id'
)))
const keys = ['_id']
Object.keys(row).sort().forEach(k => {
k = k.toLowerCase()
if (k !== '_id' && k !== 'id') {
keys.push(k)
}
})
return keys
}
private get keyListElements() {