Enable table to know when invalid column names have been passed

This commit is contained in:
Andrew Kingston 2021-03-25 14:48:28 +00:00
parent f84302ed89
commit 3c67e4806e
1 changed files with 12 additions and 1 deletions

View File

@ -77,9 +77,20 @@
} }
const getFields = (schema, customColumns, showAutoColumns) => { const getFields = (schema, customColumns, showAutoColumns) => {
if (customColumns?.length) { // Check for an invalid column selection
let invalid = false
customColumns?.forEach(column => {
if (schema[column] == null) {
invalid = true
}
})
// Use column selection if it exists
if (!invalid && customColumns?.length) {
return customColumns return customColumns
} }
// Otherwise generate columns
let columns = [] let columns = []
let autoColumns = [] let autoColumns = []
Object.entries(schema).forEach(([field, fieldSchema]) => { Object.entries(schema).forEach(([field, fieldSchema]) => {