Hello,
We are working on an application that is reading json and placing individual elements in separate grid fields once the json is in a datasubset. In one of these grid fields, we have multiple bits of data returned displayed in a single row, and would like each of those bits of data rendered dynamically as separate links on distinct lines within the grid field. Is this possible?
So, for instance
Data 1a
Data 1b
Data 1c
Data 2a
Data 2b
Data 2c
Data 2d
Thanks,
Dylan
Discussion posts and replies are publicly visible
Hello Dylan,
The following code does the following:
This rule helps you to iterate and create a dynamic link for each description.
a!forEach( items: ri!descriptions, expression: a!dynamicLink( label: fv!item ) )
Interface:
load( local!testList_cdt:{ {id:1, description:{"Apple","Apricot","Avocado"}}, {id:2, description:{"Banana","Blueberry"}} }, a!formLayout( contents:{ a!gridLayout( headerCells: { a!gridLayoutHeaderCell(label: "id"), a!gridLayoutHeaderCell(label: "description"), }, columnConfigs: { a!gridLayoutColumnConfig(width:"DISTRIBUTE"), a!gridLayoutColumnConfig(width:"DISTRIBUTE"), }, rows: a!forEach( items: local!testList_cdt, expression: a!gridRowLayout( id: index(fv!item,"id",null), contents: { a!textField( value: fv!item.id, readOnly: true ), a!linkField( links: rule!CreateLink( descriptions: fv!item.description ) ) } ) ) ) } ) )
Hope the code attached helps you to resolve your query.
Regards.
You will probably want to make your Link column a richTextDisplayField (in an Editable Grid). Using this field, you will have the freedom to iterate through any number of links per row of data, and show each link on its own line easily, and with nice-looking formatting. I don't suggest using linkField (really for anything anymore) as it's not nearly flexible enough; in this case I don't think you would be able to display multiple different links within one grid cell.