Hi, I am trying build read only selectable grid.
a!localVariables( local!businessModuleStatus: rule!CR_QE_getModuleStatusForBusiness( cif_int: ri!cif_int, moduleId_int: ri!moduleId_int ), a!boxLayout( label: index( local!businessModuleStatus, "workflowDesc_txt", "" ), style: "ACCENT", contents: { a!gridLayout( spacing: "DENSE", headerCells: { a!forEach( items: cons!CR_MODULE_STATUS_GRID_FIELDS_FOR_BUSINESS, expression: a!gridLayoutHeaderCell( label: fv!item, align: "LEFT" ) ) }, columnConfigs: { a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ), a!gridLayoutColumnConfig( width: "DISTRIBUTE", weight: 2 ) }, rows: { a!forEach( items: local!businessModuleStatus, expression: a!gridRowLayout( id: fv!item.inputRequestId1_int, contents: { a!textField( value: fv!item.workflowDesc_txt, readOnly: true(), align: "LEFT" ), a!textField( value: rule!APN_FN_getDisplayName( userId: fv!item.initiatedBy_txt ), readOnly: true(), align: "LEFT" ), a!textField( value: rule!CR_FN_DateTimeFormat( input: fv!item.initiatedOn_dt ), readOnly: true(), align: "LEFT" ), a!textField( value: fv!item.moduleStatus_txt, readOnly: true(), align: "LEFT" ), a!textField( value: rule!APN_FN_getDisplayName( userId: fv!item.approvedBy_txt ), readOnly: true(), align: "LEFT" ), a!textField( value: rule!CR_FN_DateTimeFormat( input: fv!item.approvedOn_dt ), readOnly: true(), align: "LEFT" ) } ) ) }, selectable: true(), selectionStyle: "ROW_HIGHLIGHT", selectionValue: ri!inputSelectedId_int, selectionSaveInto: { a!save( ri!inputSelectedId_int, tointeger( index( reverse( save!value ), 1, null ) ) ), a!save( ri!systemSelectedId_int, index( local!businessModuleStatus, "systemRequestId_int", "" ), ) }, selectionRequired: true() ) } ))
On selection of row one variable will get updated due to Id of a row, then if i retrieve value for second variable from localvariable. It is not updating for second variable if I select a new row.
Can someone suggest on this?
Discussion posts and replies are publicly visible
Hi it seems you have a problem while saving the value in ri!systemSelectedId_int, I'm assuming you want to save the systemRequestId_int of the selected row, what is happening in the code above is all the systemRequestId_int are getting saved in the ri due to the below code
a!save( ri!systemSelectedId_int, index( local!businessModuleStatus, "systemRequestId_int", "" )
But I suppose the ri can only hold single value hence it will get the very first value every time in order to save the selected row value use this
a!save( ri!systemSelectedId_int, index( local!businessModuleStatus, "systemRequestId_int", "" )[selectedIndex]
If you are showing a read-only grid that requires selection there is a very useful SAIL recipe for the same read only grid with selection
I hope this helps
what is here [selectedIndex]? Could you please tell?
as you select the value the index is what gets selected you must have been saving it in ri or local, please pass that