DataTable should not display type & modelId

This commit is contained in:
Michael Shanks 2020-07-02 21:22:21 +01:00
parent b930dd4739
commit 2a7926a677
1 changed files with 11 additions and 1 deletions

View File

@ -8,6 +8,16 @@
let headers = []
let store = _bb.store
const shouldDisplayField = name => {
if (name.startsWith("_")) return false
// always 'record'
if (name === "type") return false
// tables are always tied to a single modelId, this is irrelevant
if (name === "modelId") return false
return true
}
async function fetchData() {
const FETCH_RECORDS_URL = `/api/views/all_${model}`
@ -20,7 +30,7 @@
return state
})
headers = Object.keys(json[0]).filter(key => !key.startsWith("_"))
headers = Object.keys(json[0]).filter(shouldDisplayField)
} else {
throw new Error("Failed to fetch records.", response)
}