Skip to content

Commit f453714

Browse files
authored
docs(Grid): Fix popup form example bug (#3421)
* docs(Grid): Fix popup form example bug * Update components/grid/templates/popup-form-template.md
1 parent 562219d commit f453714

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

components/grid/templates/popup-form-template.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
4949
OnRead="@OnGridRead"
5050
TItem="@Product"
5151
EditMode="@GridEditMode.Popup"
52+
OnCancel="@OnGridCancel"
5253
OnDelete="@OnGridDelete">
5354
<GridToolBarTemplate>
5455
<GridCommandButton Command="Add">Add Item</GridCommandButton>
@@ -58,7 +59,7 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
5859
<GridPopupEditFormSettings Context="formContext">
5960
<FormTemplate>
6061
@{
61-
if (GridEditItem is null)
62+
if (GridEditItem != formContext.Item)
6263
{
6364
// Setting GridEditItem unconditionally may
6465
// reset the modified and unsaved values after re-render.
@@ -158,6 +159,12 @@ Using a `FormTemplate` to modify the Edit/Create Popup window.
158159
GridEditItem = default;
159160
}
160161
162+
private void OnGridCancel(GridCommandEventArgs args)
163+
{
164+
// Fires when using the Window's Close button.
165+
GridEditItem = default;
166+
}
167+
161168
private async Task OnGridDelete(GridCommandEventArgs args)
162169
{
163170
var deletedItem = (Product)args.Item;

0 commit comments

Comments
 (0)