Solved
Re-ordering dynamic list
We have a dynamic array containing lists of data. Dynamic here meaning data1, data2..etc could be any length.
We need a screen that allows users to reorder this data and we are attempting to do this with a gridLayout with allowRowReordering = true.
When attempting this example below, we are seeing the error Expression evaluation error at function a!gridLayout [line 15]: A grid layout component [label="data1"] has an invalid value for "rowOrderData". The value must be a list of records, a list of maps, or a list of dictionaries.
a!localVariables(
local!map: { "data1", "data2" },
local!data: {
data1: {
{ sortOrder: 1, label: "A" },
{ sortOrder: 2, label: "B" }
},
data2: {
{ sortOrder: 1, label: "C" },
{ sortOrder: 2, label: "D" }
}
},
a!forEach(
items: local!map,
expression: a!gridLayout(
label: fv!item,
headerCells: {
a!gridLayoutHeaderCell(label: "Checklist Sections")
},
rows: a!forEach(
items: local!data[fv!item],
expression: a!gridRowLayout(
contents: a!textField(value: fv!item.label, readOnly: true)
)
),
allowRowReordering: true,
rowOrderData: local!data[fv!item],
rowOrderField: "sortOrder"
)
)
)