I have a Datagrid component on a page.
With Double Click event I open an Edit Dialog , Save, submits and closes the dialog with return value 1 , Cancel closes the dialog with return value 0.
The behavior now is : When I close the dialog bij "saving" and "submitting" the datagrid reloads and I lose my current record focus . this has nothing to do with the return value of the dialog.
When I close the dialog using "cancel" then the focus of the record does not change and stays at the selected row of the datagrid.
Is it possible that the datagrid stays on the selected row without reloading and loosing the focus of the selected row.
With the current record / row I mean the Datagrid - row that the user has double clicked on to edit .
e.g:
if the user has double clicked on the second row of the datagrid, it becomes selected and the edit dialog wil be displayed . If the dialog is closed ( submit or cancel) the user stays on the same datagrid row , and the row stays selected .
Now the datagrid just reloads and loses the focus of the row that has been edited .
In the Then event of the Open Dialog action update the selection variable - find the object from the getXXXResult property which the Data property of the DataGrid is set to:
The value is: ${getOrdersResult}.find(o => o.Id == ${event.Id}) where getOrdersResult is the page property which the DataGrid is bound to. Id is the unique identifier (primary key) of the entity.
After doing this the selection will remain after saving the record: