-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce ItemComparer parameter to DropDownBase, for IEqualityCompar…
…er support (#1854) * Introduce ItemComparer parameter to DropDownBase. Use HashSet to track selectedItems. * include summary for ItemComparer Parameter
- Loading branch information
1 parent
11a037a
commit c9b5a53
Showing
7 changed files
with
139 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
RadzenBlazorDemos/Pages/DropDownMultipleItemComparer.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@using RadzenBlazorDemos.Models.Northwind | ||
|
||
@inherits DbContextPage | ||
|
||
<RadzenStack Orientation="Orientation.Horizontal" AlignItems="AlignItems.Center" JustifyContent="JustifyContent.Center" Gap="0.5rem" class="rz-p-sm-12"> | ||
<RadzenLabel Text="Select Values" Component="DropDownMultiple" /> | ||
<RadzenDropDown @bind-Value=@values Data=@products TextProperty="@nameof(Product.ProductName)" Name="DropDownMultiple" | ||
Multiple=true AllowClear=true Placeholder="Select products" Style="width: 100%; max-width: 400px;" | ||
ItemComparer="@Product.Comparer"/> | ||
</RadzenStack> | ||
|
||
@code { | ||
IEnumerable<Product> values = []; | ||
IEnumerable<Product> products; | ||
|
||
protected override async Task OnInitializedAsync() | ||
{ | ||
await base.OnInitializedAsync(); | ||
|
||
products = dbContext.Products; | ||
values = | ||
[ | ||
new Product { ProductName = "Chai" }, | ||
new Product { ProductName = "Aniseed Syrup" } | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters