Hi,
I have a editable grid where in one field has single select dropdown (i.e Status),
a!localVariables( local!data: rule!Data_Rule( serialNumber: null, pageBatchSize: -1 ), local!statusToUpdate, { a!gridLayout( label: "Editable Grid", labelPosition: "COLLAPSED", headerCells: { a!gridLayoutHeaderCell(label: "Serial Number"), a!gridLayoutHeaderCell(label: "Status") }, columnConfigs: {}, rows: { a!forEach( items: local!data, expression: { a!gridRowLayout( contents: { a!textField( label: "Serial Number", value: fv!item.serialNumber ), a!dropdownField( label: "Status", labelPosition: "ABOVE", choiceLabels: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus), choiceValues: rule!RWM_Status_Matrix_Rule(currentStatus:fv!item.currentStatus), value:if(not(isnull(local!statusToUpdate)),local!statusToUpdate,fv!item.currentStatus), saveInto: { a!save(local!statusToUpdate,save!value), a!save(ri!dataList, save!value) }, searchDisplay: "ON", required:true, validations: { } ) } ) } ) }, selectionSaveInto: {}, validations: {}, shadeAlternateRows: true ), a!buttonArrayLayout( buttons: { a!buttonWidget( label: "Save", style: "PRIMARY", saveInto: { /*Code to write updated value in DB*/ } ) }, align: "END" ) } )
and the value in the dropdown is populated from a expression rule file (below) which has different value for every status selected.
a!localVariables( local!pendingStatusMatrix:{"Pending","Started","Cancelled"}, local!startedStatusMatrix:{"Started","Suspended","Completed"}, local!suspendedStatusMatrix:{"Suspended","Resumed","Completed"}, local!resumedStatusMatrix:{"Resumed","Suspended","Completed"}, local!completeStatusMatrix:{"Completed"}, local!cancelledStatusMatrix:{"Cancelled"}, { if(ri!currentStatus="Pending",local!pendingStatusMatrix,{}), if(ri!currentStatus="Started",local!startedStatusMatrix,{}), if(ri!currentStatus="Suspended",local!suspendedStatusMatrix,{}), if(ri!currentStatus="Resumed",local!resumedStatusMatrix,{}), if(ri!currentStatus="Completed",local!completeStatusMatrix,{}), if(ri!currentStatus="Cancelled",local!cancelledStatusMatrix,{}) } )
There is a button (SAVE) outside of editable grid which is pressed whenever any status is changed to update it in DB.
Now, what I am trying to achieve is whenever I press on SAVE button the value should be updated in DB (its working fine for me) and single select dropdown (i.e Status) should be updated with new value options based in current status selection.
Please hep me with it.
Discussion posts and replies are publicly visible
Since local!data is populating your grid, you should refresh local!data when you click save. I recommending calling rule!Data_Rule() in the onSuccess parameter of a!writeToDataStoreEntity. If you are writing to the database using a!startProcess() you can do the same thing however you first need to make sure in your process model that you chain the process through the write to DB node.
This does not seem to work, status dropdown is not refreshing.