-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Select component(tags mode) data source is not correct #1912
Comments
I am sorry for the code format, it is my first copying code. |
@LiuyangRY thanks for contacting us. When you use a foreach or for loop, you should add However, I'm not sure this can solve your issue. I recommend you to use the DataSource approach of Select component. For your use-case, you can just use a string collection. You can post your code surrounded by ``` |
@LiuyangRY Can you post a minimal repro? |
@anranruye @anddrzejb Thanks for your suggestions, I have added the
Test.razor.cs:
|
@LiuyangRY confirmed this is a bug.
to workaround. |
@anranruye I attempted this solution and I found the highlight of selected items disappeared. |
@LiuyangRY do you change |
@anranruye Sorry, it's my inattention. Now it works normally. I want to know is this will be fixed one day so that I can avoid using |
@anddrzejb this one is similar to #1536 and #1719, we only solved the situations for single value(default mode), but not for multiple values. @LiuyangRY Of course we will, but now we don't have a plan. Welcome to open a pr if you are interested in this issue. |
@anranruye I am busy on rebuilding the company's project, what I can do is just report some issues during process. I am glad to contribute to ant-design-blazor one day. |
@anranruye I tested the #1536 for the |
Describe the bug
I use the select component(tags mode), changing the data source of the select component according to a selected value. While the data source is not showed correctly as I wanted, I watched the value but didn't find the reason,.
Steps to reproduce (please include code)
Here is the code:
Select component setup:
<Select Mode="tags" EnableSearch="true" MaxTagCount="5" TItem="string" TItemValue="string" @bind-Values="@context.Area" AllowClear="true"> <SelectOptions> @if (AreaList?.Any() ?? false) { @foreach (AreaDTO area in AreaList) { <SelectOption TItemValue="string" TItem="string" Value=@area.AreaID Label=@area.AreaID /> } } </SelectOptions>
Data source changed:
private void JobTypeChanged(NameValueRecord<string, string> item) { switch (item.Value) { case "RT": AreaList = RTAreaList; isRT = true; break; case "NonRT": AreaList = NonRTAreaList; isRT = false; break; default: break; } JobSetupService.QueryModel.area = string.Join(",", AreaList.Select(a => a.AreaID)); StateHasChanged(); }
The text was updated successfully, but these errors were encountered: