-
Notifications
You must be signed in to change notification settings - Fork 417
feat: add custom ItemProvider to FluentCombobox #3596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Done for V5. See https://fluentui-blazor-v5.azurewebsites.net/List/Combobox Don't think we will be adding this for v4 anymore |
@vnbaaij where is it in V5? The link only has documentation for PS: I can live with V5 only :) |
What I mean is some kind of way like this example from @using System.Globalization
@inject DataSource Data
<FluentStack Orientation="Orientation.Vertical" VerticalGap="10">
@* Immediate Delay *@
<FluentNumberField @bind-Value="_immediateDelay"
TValue="int"
Label="Immediate Delay"
Placeholder="Delay"
Min="0"
Max="2000"
Step="100" />
<FluentAutocomplete TOption="CultureInfo"
ImmediateDelay="_immediateDelay"
AutoComplete="off"
Label="Select Culture"
Width="250px"
OnOptionsSearch="OnSearch"
Placeholder="Select countries"
MaximumOptionsSearch="int.MaxValue"
MaximumSelectedOptions="2"
Virtualize="true"
OptionText="@(item => $"{item.DisplayName} - {item.Name}")"
@bind-SelectedOptions="@SelectedCultures" />
</FluentStack>
<p>
<b>Selected</b>: @(String.Join(" - ", SelectedCultures.Select(i => i.Name)))
</p>
@code
{
private int _immediateDelay;
IEnumerable<CultureInfo> SelectedCultures = Array.Empty<CultureInfo>();
CultureInfo[] Cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);
private void OnSearch(OptionsSearchEventArgs<CultureInfo> e)
{
e.Items = Cultures.Where(culture =>
culture.Name.Contains(e.Text, StringComparison.OrdinalIgnoreCase) ||
culture.DisplayName.Contains(e.Text, StringComparison.OrdinalIgnoreCase));
}
} Within OnSearch I do a query against the database because I don't want to fetch 3000 items into memory at once. |
Sorry, I thought you meant to just have the |
🙋 Feature Request
The
FluentCombobox
only allows you to define a pre-existing list of items. This limits the usability of this component a lot. It would be great if this component would also allow a custom item provider likeFluentAutocomplete
.If both components would offer this feature it would be much easier to bind to a single object. If you rely on a custom item provider this currently only possible with the
FluentAutocomplete
which requires some hacky tricks to achieve this behaviour.The text was updated successfully, but these errors were encountered: