DataTable should not display type & modelId
This commit is contained in:
parent
b930dd4739
commit
2a7926a677
|
@ -8,6 +8,16 @@
|
||||||
let headers = []
|
let headers = []
|
||||||
let store = _bb.store
|
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() {
|
async function fetchData() {
|
||||||
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
const FETCH_RECORDS_URL = `/api/views/all_${model}`
|
||||||
|
|
||||||
|
@ -20,7 +30,7 @@
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
|
|
||||||
headers = Object.keys(json[0]).filter(key => !key.startsWith("_"))
|
headers = Object.keys(json[0]).filter(shouldDisplayField)
|
||||||
} else {
|
} else {
|
||||||
throw new Error("Failed to fetch records.", response)
|
throw new Error("Failed to fetch records.", response)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue