Reputation: 180
I need to have all the CRUD methods be external. But there is something missing. What?
I set the UseInternalEditing=false
, define RowInserting
and the external method OnRowInserted
is not reached.
<DataGrid TItem="AppInstructor"
EditMode="Blazorise.DataGrid.DataGridEditMode.Inline"
Editable="true"
RowInserted="@OnRowInserted"
UseInternalEditing="false"
ShowValidationFeedback="true"
Data="@_instService.GetALL()">
<DataGridCommandColumn TItem="AppInstructor">
<SaveCommandTemplate>
<Button Color="Color.Primary" Clicked="@context.Clicked">Save</Button>
</SaveCommandTemplate>
<EditCommandTemplate>
<Button Color="Color.Primary" Clicked="@context.Clicked">Edit</Button>
</EditCommandTemplate>
</DataGridCommandColumn>
<DataGridColumn TItem="AppInstructor" Field="@nameof(AppInstructor.LastName)" Editable="true" Caption="First Name" Sortable="true">
</DataGridColumn>
<DataGridColumn TItem="AppInstructor" Field="@nameof(AppInstructor.LastName)" Editable="true" Caption="Last Name" Sortable="true">
</DataGridColumn>
@code {
private void OnRowInserted(SavedRowItem<AppInstructor,
Dictionary<string, object>> e)
{
...
}
Upvotes: 2
Views: 1084
Reputation: 213
You have to add PreventDefaultOnSubmit
to have your custom click event trigger.
<SaveCommandTemplate>
<Button Type="ButtonType.Submit"
PreventDefaultOnSubmit
Color="Color.Primary"
Clicked="@context.Clicked">Save</Button>
</SaveCommandTemplate>
Then RowInserted="OnRowInserted"
will be called.
Upvotes: 1