hi,
I have an editable grid and have selection enabled, it works perfectly fine , when selecting individual rows and as bulk when i chose the check box in the header,
This works
when i unselect at header , it throws error but individual row deselection works, only deselection in the header is not working
code :at line 507
selectionValue: local!selectedIndex, selectionSaveInto: { local!selectedIndex,a!save(local!selectedrows,index(local!displayItems,local!selectedIndex))},
Discussion posts and replies are publicly visible
Hi kowsalyavijayan ,
just try this logic
a!localVariables( local!items: { { item: "Item 1", qty: 1, unitPrice: 10 }, { item: "Item 2", qty: 2, unitPrice: 20 } }, local!selecteditems, a!gridLayout( label: "Products", instructions: "Selected: ", headerCells: { a!gridLayoutHeaderCell(label: "Item"), a!gridLayoutHeaderCell(label: "Qty"), a!gridLayoutHeaderCell(label: "Unit Price"), a!gridLayoutHeaderCell(label: "Total", align: "RIGHT") }, rows: a!forEach( items: local!items, expression: a!gridRowLayout( id: fv!index, contents: { a!textField( value: fv!item.item, saveInto: fv!item.item ), 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!selecteditems, selectionSaveInto: a!save( local!selecteditems, a!flatten(save!value) ), rowHeader: 1 ) )
You can try by replacing following code:
selectionSaveInto: { a!save( local!selectedIndex, a!flatten(save!value) ), a!save( local!selectedrows, if( a!isNullOrEmpty(local!selectedIndex), {}, index(local!items, local!selectedIndex) ) ) }
Please go through below example by Appian
https://docs.appian.com/suite/help/24.2/grid-with-selection-pattern.html
This works thank you