CodeBeam.MudBlazor.Extensions icon indicating copy to clipboard operation
CodeBeam.MudBlazor.Extensions copied to clipboard

MudSelectExtended - searchbox not appearing

Open hjrb opened this issue 1 year ago • 3 comments
trafficstars

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 ` <MudTabs Elevation="2" Rounded="true" ApplyEffectsToContainer="true" PanelClass="pa-6" Centered="true">

<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

hjrb avatar May 18 '24 11:05 hjrb

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

mckaragoz avatar May 20 '24 17:05 mckaragoz

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?

hjrb avatar May 21 '24 10:05 hjrb

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.

mckaragoz avatar May 21 '24 17:05 mckaragoz