Hi,
we are evaluating your products, but we cannot create a simple fully working grid.
I enclose here a sample based on a project from other forum user (Asp.net/EF core 3.0) . The sample is based on Northwind db and the relation Product<->Category.
<EjsGrid TValue="Product" DataSource="@Products" @ref="Grid" AllowSorting="true" AllowFiltering="true" AllowPaging="true" Toolbar="@(new List<Object>() { "Add", "Edit", "Delete", "Cancel", "Update" })">
<GridEvents OnActionComplete="@OnComplete" TValue="Product" />
<GridEditSettings AllowAdding="true" AllowEditing="true" AllowDeleting="true"></GridEditSettings>
<GridColumns>
<GridColumn Field=@nameof(Product.ProductId) HeaderText="Id" IsPrimaryKey="true" TextAlign="@TextAlign.Center" Width="140"></GridColumn>
<GridColumn Field=@nameof(Product.ProductName) HeaderText="Name" Width="150"></GridColumn>
<GridColumn Field=@nameof(Product.CategoryId)
ForeignKeyValue="@nameof(Category.CategoryName)"
ForeignKeyField="@nameof(Category.CategoryId)"
EditType="EditType.DropDownEdit"
DataSource="@Categories"
HeaderText="Category2" Width="150"></GridColumn>
</GridColumns>
</EjsGrid>
@code{
public static IQueryable<Product> Products { get; set; }
public static IList<Category> Categories { get; set; }
protected override void OnInitialized()
{
Products = db.Products.Include("Category").OrderBy(g => g.ProductName);
Categories = db.Categories.ToList<Category>();
}
public void OnComplete(ActionEventArgs<Product> Args)
{
if (Args.RequestType.ToString() == "Save")
{
//Update
db.SaveChanges();
}
else if (Args.RequestType.ToString() == "Delete")
{
//Delete
}
}
The sorting and paging functionalities work fine, but we got several problems that we cannot figure out.
1. if I try to filter the ProductName the grid display the waiting icon but nothing happens (see
here)
2. the same if I try to edit one row (see
here)
3. the Category column is ok but If I try to filter instead to remove the item simply hide the category name from the column (see
here)
4. I tried also without ForeingKey and ForeignValue but in this case the Category column is empty (see
here)
<GridColumn Field=@nameof(Product.Category.CategoryName) HeaderText="Category" Width="150" EditType="EditType.DropDownEdit" ></GridColumn>
I hope in your help and I would be grateful to you if you could provide me a fully working sample.
Thanks
Attachment:
BlazorApp1_b85667c.zip