Add relationships as possible datasource for grid
This commit is contained in:
parent
3dacff4636
commit
c76dccb66c
|
@ -17,7 +17,7 @@
|
||||||
export let _bb
|
export let _bb
|
||||||
export let datasource = {}
|
export let datasource = {}
|
||||||
export let editable
|
export let editable
|
||||||
export let theme = 'alpine'
|
export let theme = "alpine"
|
||||||
|
|
||||||
let dataLoaded = false
|
let dataLoaded = false
|
||||||
let data
|
let data
|
||||||
|
@ -33,6 +33,7 @@
|
||||||
rowSelection: editable ? "multiple" : false,
|
rowSelection: editable ? "multiple" : false,
|
||||||
suppressRowClickSelection: !editable,
|
suppressRowClickSelection: !editable,
|
||||||
}
|
}
|
||||||
|
let store = _bb.store
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if (datasource.modelId) {
|
if (datasource.modelId) {
|
||||||
|
@ -40,7 +41,7 @@
|
||||||
model = await jsonModel.json()
|
model = await jsonModel.json()
|
||||||
const { schema } = model
|
const { schema } = model
|
||||||
if (!isEmpty(datasource)) {
|
if (!isEmpty(datasource)) {
|
||||||
data = await fetchData(datasource)
|
data = await fetchData(datasource, $store)
|
||||||
columnDefs = Object.keys(schema).map((key, i) => {
|
columnDefs = Object.keys(schema).map((key, i) => {
|
||||||
return {
|
return {
|
||||||
headerCheckboxSelection: i === 0 && editable,
|
headerCheckboxSelection: i === 0 && editable,
|
||||||
|
@ -64,8 +65,8 @@
|
||||||
type !== "boolean" &&
|
type !== "boolean" &&
|
||||||
type !== "options" &&
|
type !== "options" &&
|
||||||
// type !== "datetime" &&
|
// type !== "datetime" &&
|
||||||
type !== "link" &&
|
type !== "link" &&
|
||||||
type !== "attachment"
|
type !== "attachment"
|
||||||
|
|
||||||
const shouldHideField = name => {
|
const shouldHideField = name => {
|
||||||
if (name.startsWith("_")) return true
|
if (name.startsWith("_")) return true
|
||||||
|
|
Loading…
Reference in New Issue