Update list autoscreen to use new data provider

This commit is contained in:
Andrew Kingston 2021-03-22 11:29:26 +00:00
parent 0b0efcd9ea
commit 827c023d5a
1 changed files with 11 additions and 3 deletions

View File

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