Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion components/grid/templates/popup-form-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
OnRead="@OnGridRead"
TItem="@Product"
EditMode="@GridEditMode.Popup"
OnCancel="@OnGridCancel"
OnDelete="@OnGridDelete">
<GridToolBarTemplate>
<GridCommandButton Command="Add">Add Item</GridCommandButton>
Expand All @@ -58,7 +59,7 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
<GridPopupEditFormSettings Context="formContext">
<FormTemplate>
@{
if (GridEditItem is null)
if (GridEditItem != formContext.Item)
{
// Setting GridEditItem unconditionally may
// reset the modified and unsaved values after re-render.
Expand Down Expand Up @@ -158,6 +159,12 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
GridEditItem = default;
}

private void OnGridCancel(GridCommandEventArgs args)
{
// Fires when using the Window's Close button.
GridEditItem = default;
}

private async Task OnGridDelete(GridCommandEventArgs args)
{
var deletedItem = (Product)args.Item;
Expand Down