CodeBeamOrg / CodeBeam.MudBlazor.Extensions

Useful third party extension components for MudBlazor, from the contributors.

Home Page:https://mudextensions.codebeam.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MudSelectExtended - searchbox not appearing

hjrb opened this issue · comments

commented

Hi,

first of all: thanks for this great library!
I'm using Blazor .NET 8 with the new @rendermode capabilities.
I'm using release 6.9.2.
I have a Razor page that uses @rendermode RenderMode.InteractiveWebAssembly

I'm using MudSelectExtended in an EditTemplate of a MudDataGrid
`

<MudTabPanel Text="Services">

   <MudDataGrid Items="@services"
          <PropertyColumn Property="x => x.Manufacturer" Title="Manufacturer" Required="false">
	   <EditTemplate>
                    <MudSelectExtended T="int?"
                        @bind-Value="context.Item.ManufacturerId"
                         Clearable="true"
                        SearchBox="true"
                         MultiSelection="false"
                         SelectAll="false"
                         @bind-Value:after="@(async ()=>{await TriggerServiceItemChanged(context.Item);})">
            @foreach (var mg in manufacturers.GroupBy(x=>x.Group))
            {
              <MudSelectItemGroupExtended Text="@(string.IsNullOrEmpty(mg.Key) ? "No Group" : mg.Key)" />
                  @foreach (var m in mg.OrderBy(a=>a.ManufacturerName))
                  {
                  <MudSelectItemExtended Value="@m.ManufacturerID" T="int?" Text="@m.ManufacturerName" />
                  }
                }
            </MudSelectExtended>
         </EditTemplate>
      </PropertyColumn>
   </EditTemplate>

//...
The select appears. Grouping works. But the SearchBox does not appear. I assume it has to with how services are registered regarding @rendermode For Mudblazor I used this to register the regular MudBlazor services in Mainlayout.razor in the client project.
<MudThemeProvider IsDarkMode="true" @rendermode="RenderMode.InteractiveWebAssembly" />
<MudDialogProvider @rendermode="RenderMode.InteractiveWebAssembly"
FullWidth="true"
MaxWidth="MaxWidth.Medium"
CloseButton="true"
NoHeader="false"
Position="DialogPosition.Center"
CloseOnEscapeKey="true"
/>
<MudSnackbarProvider @rendermode="RenderMode.InteractiveWebAssembly" />
`

What can I do?
MudSelectExtended issue

Hi, SearchBox only show when you use ItemCollection. If you use RenderFragments, need to implement you own search field.

commented

Thank you so much. Works! Maybe add this to the documentation. Or better: create a compiler waning that if SearchBox is true but ItemCollection is null .
One more question: is it possible to use ItemCollection and grouping at once?

Currently not, there is also an issue #349. It would be good implementation but need to work on other features. We are open to PR if someone volunteered.