...
<EjsGrid DataSource="@gridData" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Normal"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(OrdersDetails.OrderID) HeaderText="Order ID" IsPrimaryKey="true" Width="120"></GridColumn>
...
<GridColumn Field=@nameof(OrdersDetails.ShipCountry) HeaderText="Ship Country" EditType="dropdownedit" Width="150"></GridColumn>
</GridColumns>
</EjsGrid>
@code{
public List<OrdersDetails>
gridData { get; set; }
protected override void OnInit()
{
gridData = OrdersDetails.GetAllRecords();
}
} |
...
<EjsGrid DataSource="@gridData" AllowPaging="true" Toolbar="@(new List<string>() { "Add", "Edit", "Delete", "Cancel", "Update" })" OnActionComplete="@actionCompletedHandler">
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true" Mode="@EditMode.Normal"></GridEditSettings>
<GridColumns>
...
</GridColumns>
</EjsGrid>
@functions{
public List<OrdersDetails>
gridData { get; set; }
protected override void OnInit()
{
gridData = OrdersDetails.GetAllRecords();
}
public void actionCompletedHandler(ActionEventArgs args)
{
if(args.RequestType.ToString() == "Save")
{ //you can get edited data by using args.Data
var data = JsonConvert.DeserializeObject<OrdersDetails>(JsonConvert.SerializeObject(args.Data)); //for getting serialized data
// Here you can process your operation to store database
}
}
}
|
|
I do not need a working example (which of course is perfect, if you can provide it). Pseudo code or links to documentation would do.
Thanks again for your really fast response and your good support.I am aware of the fact, that Blazor is a brand new moving target and changing constantly at the moment. You do a really good job !
regards
Uwe