-
Notifications
You must be signed in to change notification settings - Fork 461
Closed
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigationv5For the next major versionFor the next major version
Description
🙋 Feature Request
v5 allows you to create a nullable FluentSelect like this:
@using Samples = SampleData.People;
<FluentSelect Label="Coworker"
Placeholder="Select a coworker"
Items="@Coworkers"
@bind-Value="@Value"
OptionText="@(item => item?.FirstName)"
OptionValue="@(item => item?.Id)"
OptionDisabled="@(item => item == Coworkers.ElementAt(3))" />
<div>
Selected: @Value?.Id - @Value?.FirstName
</div>
@code {
static Samples.Person?[] OneNullPerson = new Samples.Person?[] { null };
static Samples.Person?[] Coworkers =>
OneNullPerson.Union(Samples.Persons.Take(5).ToArray()).ToArray();
Samples.Person? Value = Coworkers.ElementAt(2);
}This requires some additional effort from the developer everytime. It would be great if this can be handled by the library somehow.
💁 Possible Solution
Perhaps we can introduce a new parameter AllowNull which will automatically append it as the first option. The OptionText can then handle the null-case to display a message. We could even add another property NullTemplate which can be defined by the user with the new defaults feature.
🔦 Context
I have a like 20 selects in one form which are all nullable. This would reduce the amount of work for the developer a lot and would make this component even more useful IMO.
Metadata
Metadata
Assignees
Labels
status:needs-investigationNeeds additional investigationNeeds additional investigationv5For the next major versionFor the next major version