CodeBeam.MudBlazor.Extensions
CodeBeam.MudBlazor.Extensions copied to clipboard
[Bug] MudListExtended SelectAllState is not correctly set with initial selection
Using the MudListExtended component if the SelectAll option is enabled, and set the ItemCollection and SelectedValues to different lists but with the same elements, the SelectAll checkbox is not correctly set initially, it remains blank.
Can be reproduced on the test page:
https://codebeam-mudextensions.pages.dev/mudlistextended
In the The Variants section if you click the MultiSelection and Select All, the Select All checkbox should be in intermediate state.
The issue can be caused by this condition in OnAfterRender:
You mean setting values individually doesn't set select all checkbox automatically, right?
Yes, basicly if you set the SelectedValues programatically to some non empty collection, after the List component loading, the state of the select all checkbox should be set accordingly.
This image is from the demo site, after page load. Here, the Sparkling Water is set by default in code. The problem is that the select all checkbox is not in intermediate state but in false state.
Current workaround for me is easy because i already have a custom inherited class, so i just call UpdateSelectAllState after render in my code:
protected override Task OnAfterRenderAsync(bool firstRender)
{
// Workaround for https://github.com/CodeBeamOrg/CodeBeam.MudBlazor.Extensions/issues/288
if (firstRender)
UpdateSelectAllState();
return base.OnAfterRenderAsync(firstRender);
}
I think the bug is not only about on first render, so we should add a mechanism that updates select all state on programmatically change, at least we should add a manual method that users can freely call to update.