Skip to content

Commit

Permalink
DataGrid OData demo fixed
Browse files Browse the repository at this point in the history
Fix #1786
  • Loading branch information
enchev committed Nov 13, 2024
1 parent df9887b commit f3badc0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions RadzenBlazorDemos/Models/Northwind/Employee.Custom.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace RadzenBlazorDemos.Models.Northwind
{
public partial class Employee
{
[NotMapped]
public ICollection<Order> NorthwindOrders { get; set; }
}
}
4 changes: 2 additions & 2 deletions RadzenBlazorDemos/Pages/DataGridOData.razor
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
Change=@OnSelectedTitlesChange Data="@(titles)" AllowClear="true" Multiple="true" />
</FilterTemplate>
</RadzenDataGridColumn>
<RadzenDataGridColumn Title="Customers" Property="Orders" FilterProperty="Customer/CustomerID" Sortable=false
<RadzenDataGridColumn Title="Customers" Property="NorthwindOrders" FilterProperty="Customer/CustomerID" Sortable=false
Type="typeof(IEnumerable<Customer>)" FilterValue="@selectedCustomers" FilterOperator="FilterOperator.In">
<FilterTemplate>
<RadzenDropDown @bind-Value=@selectedCustomers Style="width:100%" TextProperty="@nameof(Customer.CompanyName)" ValueProperty="@nameof(Customer.CustomerID)" InputAttributes="@(new Dictionary<string,object>(){ { "aria-label", "select company" }})"
Change=@OnSelectedCustomersChange Data="@(customers)" AllowSelectAll="false" Multiple="true" MaxSelectedLabels="2" />
</FilterTemplate>
<Template>
@(string.Join(',', context.Orders != null ? context.Orders.Select(i => i.Customer.CompanyName) : Enumerable.Empty<string>()))
@(string.Join(',', context.NorthwindOrders != null ? context.NorthwindOrders.Select(i => i.Customer?.CompanyName) : Enumerable.Empty<string>()))
</Template>
</RadzenDataGridColumn>
<RadzenDataGridColumn Property="@nameof(Employee.TitleOfCourtesy)" Title="Title Of Courtesy" />
Expand Down

0 comments on commit f3badc0

Please sign in to comment.