Angular Datagrid dialog navigation

Hi ,

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.

What is "current record focus"? The data grid reloads otherwise you will not see the changes you have made.

Hi @korchev

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 .

You can persist the selection like this:

  1. Create a page property called selection with value null.
  2. Set the Value of your DataGrid to ${selection}:
  3. 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:

persist-selection

Thanx! @korchev , this works as expected!

Any chance to adapt this functionality as standard ( also nice to have in Blazor).