Hi Experts,
I have a user requirement for which I need to create a Nested Grid. Structure is as given below
{ { Index:1, { id: 1, text: "abc", fee:123}, { id: 2, text: "def", fee:1123}, }, { Index:2, { id: 1, text: "xyz", fee:123} { id: 2, text: "xxx", fee:112}, { id: 3, text: "yyy", fee:133} } }
For this I have created
CDT 1 have fields as below:
where field "grid" is of type cdt 2 which have structure as below
Now I have to deign the grid in such a way that I can add multiple editable grid and store the data entered in grid respectively.
I'm trying to use below code snippet but not able to store the values entered in the grid.
a!localVariables( local!counter: 0, local!grid: ri!multiFeeGrid.grid, { a!columnsLayout( columns: { a!columnLayout( contents: { a!linkField( label: "", links: a!dynamicLink( label: "Add Amendments", saveInto: { a!save(local!counter, local!counter + 1), a!save( ri!multiFeeGrid, append( ri!multiFeeGrid, 'type!{urn:com:appian:types:CS}CS_multiLicenseFee'( index:local!counter, grid:local!grid ) ) ) } ) ) } ), a!columnLayout( contents: { a!linkField( label: "", links: a!dynamicLink( label: "Remove Amendments", saveInto: { a!save(local!counter, local!counter - 1), } ) ) } ) } ), a!forEach( items: enumerate(local!counter), expression: { a!cardLayout( contents: { a!sideBySideLayout( items: { a!sideBySideItem( width: "MINIMIZE", item: a!richTextDisplayField( value: { a!richTextItem( text: "The fees payable by the Licensee as at the Commencement Date are as follows: ", ) } ) ) } ), a!columnsLayout( columns: { a!columnLayout( width: "WIDE", contents: a!gridLayout( label: "", labelPosition: "ABOVE", emptyGridMessage: "No Data Available", headerCells: { a!gridLayoutHeaderCell(label: "Items"), a!gridLayoutHeaderCell(label: "Fee (in $ per year)"), a!gridLayoutHeaderCell(label: ""), }, columnConfigs: { a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1), a!gridLayoutColumnConfig(width: "DISTRIBUTE", weight: 1), a!gridLayoutColumnConfig(width: "ICON") }, rows: { a!forEach( items: local!grid, expression: a!gridRowLayout( contents: { a!textField( value: fv!item.text, saveInto: { fv!item.text , a!save( ri!multiFeeGrid, 'type!{urn:com:appian:types:CS}CS_multiLicenseFee'( index:local!counter, grid:local!grid ) ) }, refreshAfter: "KEYPRESS", required: true(), ), a!floatingPointField( value: fv!item.fee, saveInto: { fv!item.fee, a!save( ri!multiFeeGrid, 'type!{urn:com:appian:types:CS}CS_multiLicenseFee'( index:local!counter, grid:local!grid ) ) }, refreshAfter: "KEYPRESS", required: true() ), a!richTextDisplayField( value: { a!richTextIcon( icon: "close", link: { a!dynamicLink( value: fv!index, saveInto: { a!save( local!grid, remove(local!grid, save!value), ) } ) }, linkStyle: "STANDALONE", ) } ) } ) ) }, selectionSaveInto: {}, addRowlink: a!dynamicLink( label: "Add Item", value: { 'type!{urn:com:appian:types:TCA}LicenseFees'(text: "", fee: null) }, saveInto: { a!save( local!grid, append(local!grid, save!value) ), a!save( ri!multiFeeGrid, 'type!{urn:com:appian:types:CS}CS_multiLicenseFee'( index:local!counter, grid:local!grid ) ) } ), validations: {}, shadeAlternateRows: true ) ) } ), a!sideBySideLayout( items: { a!sideBySideItem( width: "MINIMIZE", item: a!richTextDisplayField( value: { "Total License Fees payable annually at the Commencement Date: ", a!richTextItem( text: dollar( if( rule!APN_isBlank(local!grid), 0, sum(local!grid.fee) ) ), style: "STRONG" ), a!richTextItem( text:", or payment of equal monthly instalments of ", ), a!richTextItem( text: dollar( if( rule!APN_isBlank(local!grid), 0, sum(local!grid.fee)/12 ) ), style: "STRONG" ) } ) ) } ) } ) } ) } )
Discussion posts and replies are publicly visible