Skip to content
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

fix: Modifying the SelectedOptions in FluentSelect #2314

Closed
beowulf29a opened this issue Jul 2, 2024 · 1 comment · Fixed by #2316
Closed

fix: Modifying the SelectedOptions in FluentSelect #2314

beowulf29a opened this issue Jul 2, 2024 · 1 comment · Fixed by #2316
Labels
status:in-progress Work is in progress

Comments

@beowulf29a
Copy link

🐛 Bug Report

Unable to "deselect" options from the FluentSelect component when Multiple=true.

💻 Repro or Code Sample

@page "/selectTest"
 
 
<FluentCheckbox ValueChanged="ToggleSelectAll" Label="Select All" />
 
<FluentSelect TOption="string"
              Items="@PossibleStrings"
              Multiple="true"
              @bind-SelectedOptions="@SelectedStrings"
              Width="100%" />
 
 
@code {
    IEnumerable<string> PossibleStrings { get; set; } = new List<string>()
    {
        "Test 1",
        "Test 2",
        "Test 3",
        "Test 4",
        "Test 5",
        "Test 6",
        "Test 7",
        "Test 8",
        "Test 9",
        "Test 10"
    };
 
    IEnumerable<string> SelectedStrings { get; set; } = [];
 
    void ToggleSelectAll(bool isChecked)
    {
        if (isChecked)
        {
            SelectedStrings = PossibleStrings;
        }
        else
        {
            SelectedStrings = [];
        }
    }
}

🤔 Expected Behavior

I would expect that clearing the bound "SelectedOptions" will also reset the internal collection of what indices are

😯 Current Behavior

Clearing the bound collection doesn't update the UI with the items which are selected.

💁 Possible Solution

🔦 Context

I would like to be able to have a select all/deselect all option associated with my multi-select FluentSelect component.

🌍 Your Environment

Windows
Edge
.NET 8.0.3 & FluentUI 4.8.1

  • OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
  • Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
  • .NET and Fluent UI Blazor library Version [e.g. 8.0.2 and 4.4.1]
@microsoft-github-policy-service microsoft-github-policy-service bot added the triage New issue. Needs to be looked at label Jul 2, 2024
@vnbaaij vnbaaij added status:in-progress Work is in progress and removed triage New issue. Needs to be looked at labels Jul 3, 2024
@beowulf29a
Copy link
Author

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:in-progress Work is in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants