Save behavior in DataGrid with Form

When using the DataGrid with Form template, the save behavior after a create seems troublesome. Is there anyway for us to change the template ourselves? It is an awesome tool and template but it would suck to have to add standardized code changes to every single auto-generated page.

Here is the template's User Experience (UX):

  1. User clicks Add button
  2. User completes the form
  3. User clicks Save button
    a. This results in the record not being added to the list on the left.
  4. User desires one of four typical paths:
    a. Make a correction on the form and save again. This results in an error message "Cannot save". I suspect this is because the primary key is not updated to the local copy of the record during the initial save.
    b. Add a new form. If we did step 5a above first, clicking the Add button doesn't remove the error message.
    c. Click another record in the list. If the user fails to click the save button, they are not prompted to save the record first, so the data entry is lost.
    d. Leave the page. If the user fails to click the save button, they are not prompted to save the record first, so the data entry is lost.

I made these changes to the code to achieve the desired behaviors:

In code behind:

    protected async Task AddButtonClick(MouseEventArgs args)
    {
        isEdit = false;
        aaApplicationModule = new EAHub.Models.EA_HUB.AaApplicationModule();

        // Clear any prior alert messages here
        // If error is "Cannot Save ..." then popup message to user first??
        errorVisible = false;
    }
    protected async Task FormSubmit()
    {
        try
        {
            var result = isEdit ? await EA_HUBService.UpdateAaApplicationModule(aaApplicationModule.Id, aaApplicationModule) : await EA_HUBService.CreateAaApplicationModule(aaApplicationModule);

            // Refresh the grid so the new record shows up
            await grid0.RefreshDataAsync();

            // Tell user the record has been save successfully
            NotificationService.Notify(new NotificationMessage
            {
                    Severity = NotificationSeverity.Success,
                    Duration = 2000,
                    Summary = "Successly Saved",
                    Detail = "Record successfully saved"
            });

           // Put record into edit mode
           isEdit = true;
        }
        catch (Exception ex)
        {
            errorVisible = true;
        }
    }

Any chance we can add these changes to the template ourselves? If not, can it be added to Studio for all the grid templates?