Refreshing Record Backed Grid After writeToDataStoreEntity
I have an interface that displays an interface with a form if a local variable is true, else it shows an interface with a grid. The desired behavior is once the user creates an item using the form, the grid will automatically update to display the new item in the grid. It does not do this. The user has to click the grid refresh button to see the new item.
The form saves the item using writeToDataStoreEntity in the saveInto of the submit button. On success, it changes the value of the boolean which causes the grid to appear to the user.
The grid is a record-backed grid. Changing the grid to use a DSE or changing the form to use a record are not allowed. A process model is also not allowed.
Placing the recordData in a local variable and using refreshAfterVarChange does not update the recordData. Using the refreshOnVarChange parameter in the grid does not refresh the data. Placing the grid interface in a local variable with refreshOnVarChange also does not cause the recordData to update.
Since I am changing the boolean only after the writeToDataStoreEntity is successful, I assume the data has been saved to the database before the boolean changes. I would also assume that once the boolean changes, the refreshOnVarChange would cause a!recordData(..) to run again causing the record to retrieve the newly saved item.
Can someone explain why the above logic is wrong and offer a suggestion for how to update the record data?
Below are the relevant parts of the code:
PARENT INTERFACE:
local!viewForm: false,
if( viewForm, rule!myForm(viewForm: local!viewForm), rule!viewGrid(viewForm: local!viewForm))
GRID INTERFACE:
a!cardLayout(contents: link: a!dynamicLink(saveInto: a!save(ri!viewForm, true)),
a!gridField(refreshOnVarChange: ri!viewForm, data: a!recordData(....))
FORM INTERFACE:
a!buttonWidget(saveInto: a!writeToDataStoreEntity(onSuccess: a!save(ri!viewForm, false)
