Update list autoscreen to use new data provider

This commit is contained in:
Andrew Kingston 2021-03-22 11:29:26 +00:00
parent 521a282aef
commit 96e59e6149
1 changed files with 11 additions and 3 deletions

View File

@ -70,14 +70,20 @@ function generateTitleContainer(table) {
} }
const createScreen = table => { const createScreen = table => {
const datagrid = new Component("@budibase/standard-components/datagrid") const provider = new Component("@budibase/standard-components/dataprovider")
.instanceName(`Data Provider`)
.customProps({ .customProps({
datasource: { dataSource: {
label: table.name, label: table.name,
name: `all_${table._id}`, name: `all_${table._id}`,
tableId: table._id, tableId: table._id,
type: "table", type: "table",
}, },
})
const grid = new Component("@budibase/standard-components/datagrid")
.customProps({
dataProvider: `{{ literal ${provider._json._id} }}`,
editable: false, editable: false,
theme: "alpine", theme: "alpine",
height: "540", height: "540",
@ -86,6 +92,8 @@ const createScreen = table => {
}) })
.instanceName("Grid") .instanceName("Grid")
provider.addChild(grid)
const mainContainer = new Component("@budibase/standard-components/container") const mainContainer = new Component("@budibase/standard-components/container")
.normalStyle({ .normalStyle({
background: "white", background: "white",
@ -105,7 +113,7 @@ const createScreen = table => {
.type("div") .type("div")
.instanceName("Container") .instanceName("Container")
.addChild(generateTitleContainer(table)) .addChild(generateTitleContainer(table))
.addChild(datagrid) .addChild(provider)
return new Screen() return new Screen()
.component("@budibase/standard-components/container") .component("@budibase/standard-components/container")