我需要让所有的 CRUD 方法都是外部的。但是缺少一些东西。什么?
我设置了UseInternalEditing=false
, define并且没有达到RowInserting
外部方法。OnRowInserted
代码
<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)
{
...
}