fgilde / MudBlazor.Extensions

MudBlazor.Extensions from https://www.mudex.org is a small extension for MudBlazor from https://mudblazor.com
http://www.mudex.org
MIT License
245 stars 20 forks source link

MudExObjectEditForm: text (string) RenderWith dropdown (select) #65

Closed SKSniperSK closed 1 year ago

SKSniperSK commented 1 year ago

Feature request type

Enhance component

Component name

MudExObjectEditForm

Is your feature request related to a problem?

In my model I have a string value that I want to be populated based on a dropdown select input (where the entries are generated based on context, so I cannot use static strings/enums). I tried to get it working a bit 'hacky' with the "RenderAs" function by passing in the MudSelect component (along with the properties including a RenderFragment of the MudSelectItems as ChildElement etc.) but did not manage to get it working properly.

Describe the solution you'd like

I would like some way to use a dropdown as input component to set a value in the passed model.

Have you seen this feature anywhere else?

No

Describe alternatives you've considered

The only alternative I see is to not use MudExObjectEditForm and build the whole form manually.

Pull Request

No response

Code of Conduct

fgilde commented 1 year ago

It allready possible. You can set the property "AvailableItemsLoadFunc" in meta config or inherit the MudExSelect. Please have a look at this discussion https://github.com/fgilde/MudBlazor.Extensions/discussions/60 or create a new discussion

fgilde commented 1 year ago

Also you can use for simple string the RenderWithAutoComplete method on your meta like this

meta.Property(m => m.SimpleString).RenderWithMudAutocomplete(new[] { "Item 1", "Item 2", "Another Item" });

I've created a sample for you here https://mudex.azurewebsites.net/object-edit-selection

SKSniperSK commented 1 year ago

Thanks a lot for the quick response! The link in your latest response with the sample throws an error (Unhandled exception rendering component: Cannot provide a value for property 'ScrollManager' on type 'MudBlazor.MudAutocomplete`1) Is there any kind of documentation I missed for all these things (besides the documentation tab on the examples page)? Because I was net even really aware that "RenderWithMudAutocomplete" exists...

fgilde commented 1 year ago

try again now. There is a problem with mudAutoComplete. not my bug i guess but you can easially archive your list selection with MudExSelect