I would like to use a!applyComponents to dynamically generate Sail components fo

I would like to use a!applyComponents to dynamically generate Sail components for a section layout. To simplify the problem, I've broken it down to just basic Sail components for testing. As we all know, this works fine:
a!sectionLayout(
firstColumnContents: {
a!textField(
label: "TEST1",
readOnly: true
),
a!textField(
label: "TEST2",
readOnly: true
)
}
)
But I want to have multiple Test1 and Test2 text boxes based off some array inside this section, so I wrap my text components up in a rule, and try this:
a!sectionLayout(
firstColumnContents: {
a!applyComponents(
rule!SubReviewTest(x:_),
{1,2}
)
}
)
Where SubReviewTest is:
{
a!textField(
label: "TEST 1 " & ri!x,
readOnly: true
),
a!textField(
label: "TEST 2 " & ri!x,
readOnly: true
)
}
The interface errors out with: "Unexpected error in ColumnLayout. Its configuration may be invalid." If I use section layout to grou...

OriginalPostID-156944

OriginalPostID-156944

  Discussion posts and replies are publicly visible

Parents
  • 0
    Certified Lead Developer
    This is most likely because apply components returns a list of lists, which will not work inside firstColumnContents. This may require a bit of tweaking on your end, but this should provide a good jumping off point:

    change your applyComponents line to:
    reduce(fn!append, {}, a!applyComponents(function: rule!subreviewTest(_), array: {1,2}))
Reply
  • 0
    Certified Lead Developer
    This is most likely because apply components returns a list of lists, which will not work inside firstColumnContents. This may require a bit of tweaking on your end, but this should provide a good jumping off point:

    change your applyComponents line to:
    reduce(fn!append, {}, a!applyComponents(function: rule!subreviewTest(_), array: {1,2}))
Children
No Data