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

MudTable - Multi level grouping not in sync with items selected #9474

Open
3 of 4 tasks
WillCodeForCash opened this issue Jul 22, 2024 · 1 comment
Open
3 of 4 tasks

Comments

@WillCodeForCash
Copy link

Things to check

  • I have searched the existing issues for this bug
  • To rule out a caching problem I made sure the bug also happens in an incognito tab

Bug type

Component

Component name

MudTable

What happened?

A MudTable with multi level grouping and multi selection does not mark nested groupings as selected unless another row-expansion is performed.
Exact same issue as #5759, but for multi level groupings.

Expected behavior

Intermediate groupings should be able to render their selection state checkbox regardless of whether the innermost group is expanded or not.

Reproduction link

https://try.mudblazor.com/snippet/QuwyOBcmoQHHnOLx

Reproduction steps

  1. Select a top level grouping
  2. Expand top level grouping
  3. Observe that nested groupings do not show as being selected
  4. Expand nested grouping
  5. Observe that all groupings now show the correct selection state

Relevant log output

No response

Version (bug)

7.3.0

Version (working)

No response

What browsers are you seeing the problem on?

Firefox, Chrome

On which operating systems are you experiencing the issue?

Windows

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct
@WillCodeForCash
Copy link
Author

WillCodeForCash commented Jul 22, 2024

Can be fixed by updating checkbox state when already doing special treatment of grouped in OnInitializedAsync

diff --git a/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs b/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
index 5c9742303..75f8f4a4c 100644
--- a/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
    b/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
@@ -195,6  195,7 @@ namespace MudBlazor
             {
                 _innerGroupItems = Table?.GetItemsOfGroup(GroupDefinition.InnerGroup, Items);
             }
             Context?.UpdateRowCheckBoxes();
         }
 
         /// <summary>

Alternatively if UpdateRowCheckBoxes is too expensive

diff --git a/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs b/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
index 5c9742303..785484aea 100644
--- a/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
    b/src/MudBlazor/Components/Table/MudTableGroupRow.razor.cs
@@ -195,6  195,13 @@ namespace MudBlazor
             {
                 _innerGroupItems = Table?.GetItemsOfGroup(GroupDefinition.InnerGroup, Items);
             }
 
             if(Table?.SelectedItems != null && _items != null)
             {
                 var containedSelectionsCount = _items.Count(s => Table?.SelectedItems?.Contains(s) == true);
 
                 _checked = containedSelectionsCount == _items.Count() ? true : containedSelectionsCount > 0 ? null : false;
             }
         }
 
         /// <summary>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant