Hi everyone,
I need help checking whether I’m doing something wrong with my code.
I’m having an editable grid with data is a data subset local variable. In it’s gridRowLayout() I also provided the id parameter. But somehow when selecting the row, it does not save any data to local!selectedAzureId. I also tried with fv!index instead of fv!item.fileId but did not work either.
{ a!gridLayout( label: "Documents", labelPosition: "COLLAPSED", headerCells: {}, columnConfigs: {}, rows: a!forEach( items: local!data.data, expression: a!gridRowLayout( id: fv!item.fileId, contents: {} ) ), selectable: true, selectionValue: local!selectedAzureIds, selectionSaveInto: { a!save( local!selectedAzureIds, a!flatten(save!value) ), a!save( ri!selectedAzureIds, local!selectedAzureIds ), }, rowHeader: 1, showWhen: rule!AAA_CMN_IsEmpty(local!curDoc), ),
And below is local!data – the gridLayout data source:
Discussion posts and replies are publicly visible
i am assuming you have intentionally removed the headerCells and content of. a!gridRowLayout .
check if there is typo in the fv!item.fileId . not sure why fv!index didnt work out for you. Below code worked.
a!localVariables( local!data: todatasubset({ {fileId: 1, qty: 1, unitPrice: 10}, {fileId: 2, qty: 2, unitPrice: 20} }), local!selectedAzureIds:tointeger({}), { a!gridLayout( label: "Documents", labelPosition: "COLLAPSED", headerCells: { a!gridLayoutHeaderCell(label: "Item"), a!gridLayoutHeaderCell(label: "Qty"), a!gridLayoutHeaderCell(label: "Unit Price"), a!gridLayoutHeaderCell(label: "Total", align: "RIGHT") }, columnConfigs: {}, rows: a!forEach( items: local!data.data, expression: a!gridRowLayout( id: fv!item.fileId, contents: { a!textField( value: fv!item.fileId, saveInto: fv!item.fileId ), a!integerField( value: fv!item.qty, saveInto: fv!item.qty ), a!floatingPointField( value: fv!item.unitPrice, saveInto: fv!item.unitPrice ), a!textField( value: a!currency( isoCode: "USD", value: tointeger(fv!item.qty) * todecimal(fv!item.unitPrice) ), readOnly: true, align: "RIGHT" ) } ) ), selectable: true, selectionValue: local!selectedAzureIds, selectionSaveInto: { a!save( local!selectedAzureIds, a!flatten(save!value) ), }, rowHeader: 1, ),} )
I don't think it is typo. If I use that id for the row content it works...Just found out if I click check all boxes, I can see the id stored into the local variable, so it does not work only when I choose a single row @@
Did you try using append function while saving save!value to the local!selectedAzureIds. Something like this
a!save( local!selectedAzureIds, append(local!selectedAzureIds,save!value) )
Can you please tell me, is your code is working without configuring "headerCells" and "contents" parameters ?