Hi there,
I wonder if you could help with this please?
The code below had a Template to convert and display user's Role from the RoleID. Edit Template uses a two-way binding to a custom component to allow user to select the role from a dropdown list. Everything is working perfectly, e.g. the grid row can be edited and once the Job role been selected and I can see the Job role column displayed the new role name immediately after I select a new role from the editing page as well.
However, the issue is if I click the cancel button in the "Edit" screen instead of "Save" button, my grid column still displayed the value I selected in the edit screen before I came out the Editing page. (if that makes any sense) So, I end up with the Job role name, which I mean to cancel, stuck in the Grid, and I had to refresh "F5" or go to different page and come back to refresh the page and get ride of it, e.g. re-pull the value from database.
Is there a better way to: 1) refresh grid after the cancel button clicked (like the build-in delete and add button) 2) have a OnCancel event handler, so I can call the grid refresh myself.
Many thanks
Linqing
<GridColumn Field=@nameof(UserModel.DefaultJobRoleID) HeaderText="Job Role" MinWidth="160" MaxWidth="180" EditType="EditType.DropDownEdit">
<Template>
@{
var um = (context as UserModel);
<div>
<span>@jobRoleList.FirstOrDefault(j => j.RefJobRoleID == um.DefaultJobRoleID)?.Name</span>
</div>
}
</Template>
<EditTemplate>
<JobRoleDropDownList @bind-RefJobRoleID=@((context as UserModel).DefaultJobRoleID)></JobRoleDropDownList>
</EditTemplate>
</GridColumn>