fix: FluentSelect does not work inside FluentDataGrid
See original GitHub issue🐛 Bug Report
When using FluentSelect inside FluentDataGrid dropdown is not shown.
💻 Repro or Code Sample
Based on these examples:
https://brave-cliff-0c0c93310.azurestaticapps.net/SelectPage
https://brave-cliff-0c0c93310.azurestaticapps.net/DatagridPage
I would also like some better examples working with enum values and select. I had to write my own code but I think this should be documented better. Added MatSelectItem as example since it works with FluentDataGrid. Select works fine with Enum when not used in FluentDataGrid
<p>
<MatSelectItem @bind-Value="@threatDto.Severity" Label="Severity" Items="@SeverityValues" FullWidth="true" Required="true">
</MatSelectItem>
</p>
<p>
<FluentSelect @bind-Value="@threatDto.Severity" Options="@SeverityOptionList" Required="true">
</FluentSelect>
</p>
<FluentDataGrid id="ExternalLinksGrid" RowsData=RowsGrid1 ColumnDefinitions=ExternalLinkColumns GridTemplateColumns="1fr 1fr" TItem=ExternalLink Context="tableRowContext">
<RowItemTemplate>
<FluentDataGridRow>
<FluentDataGridCell GridColumn=1>
<FluentTextField @bind-Value=@tableRowContext.Link></FluentTextField>
</FluentDataGridCell>
<FluentDataGridCell GridColumn=2>
<FluentSelect @bind-Value="@tableRowContext.LinkType" Options="@LinkTypeOptionList" Required="true">
</FluentSelect>
</FluentDataGridCell>
<FluentDataGridCell GridColumn=3>
<MatSelectItem @bind-Value="@tableRowContext.LinkType" Label="LinkType" Items="@LinkTypeValues" Required="true">
</MatSelectItem>
</FluentDataGridCell>
</FluentDataGridRow>
</RowItemTemplate>
</FluentDataGrid>
public List<ColumnDefinition<ExternalLink>> ExternalLinkColumns = new();
List<Severity?> SeverityValues = Enum.GetValues(typeof(Severity)).Cast<Severity?>().Where(x => x != Severity.None).ToList();
List<LinkType?> LinkTypeValues = Enum.GetValues(typeof(LinkType)).Cast<LinkType?>().Where(x => x != LinkType.None).ToList();
List<Option<Severity?>> SeverityOptionList = Enum.GetValues(typeof(Severity)).Cast<Severity?>().Where(x => x != Severity.None).Select(x => new Option<Severity?> { Key = x.Value, Value = x.Value }).ToList();
List<Option<LinkType?>> LinkTypeOptionList = Enum.GetValues(typeof(LinkType)).Cast<LinkType?>().Where(x => x != LinkType.None).Select(x => new Option<LinkType?> { Key = x, Value = x }).ToList();
List<ExternalLink> RowsGrid1 = new()
{
new ExternalLink(){ Link = "123", LinkType = LinkType.JiraRisk},
new ExternalLink(){ Link = "12345", LinkType = LinkType.OtherHyperlink},
};
protected override void OnInitialized()
{
ExternalLinkColumns.Add(new ColumnDefinition<ExternalLink>("Link", x => x.Link));
ExternalLinkColumns.Add(new ColumnDefinition<ExternalLink>("Link Type", x => x.LinkType));
ExternalLinkColumns.Add(new ColumnDefinition<ExternalLink>("Link Type MatSelectItem", x => x.LinkType));
}
Classes:
[Required, EnumDataType(typeof(Severity))]
public Severity? Severity { get; set; }
public class ExternalLink : Entity
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[Required]
[MaxLength(2048)]
public string Link { get; set; }
[Required, EnumDataType(typeof(LinkType))]
public LinkType? LinkType { get; set; }
}
public enum LinkType
{
None = 0,
OtherHyperlink = 1,
JiraIssue = 2,
JiraRisk = 3,
}
🤔 Expected Behavior
Should render drop down on click
😯 Current Behavior
No drop down is visible
💁 Possible Solution
🔦 Context
I can not use Fluent UI alone
🌍 Your Environment
- OS & Device: Windows
- Browser Chrome
- .NET and FAST Version .NET 6, Microsoft.Fast.Components.FluentUI 1.5.1 @fluentui/web-components 2.5.4
Issue Analytics
- State:
- Created a year ago
- Comments:17 (10 by maintainers)
Top Results From Across the Web
fix: Can't use fluent-select inside fluent-data-grid · Issue ...
I have tried to get this working with the Blazor components, but could not get it to work. Is seems to be an...
Read more >fluent-data-grid
The fluent-data-grid component is used to display tabular data. The fluent-data-grid-row and fluent-data-grid-cell components are typically ...
Read more >fluent ui - In details list there is loss of selection state if ...
When I double click/ onItemInvoked on any row, it console logs correct fruit name says Berries. But the problem is when I collapsed...
Read more >Fluent UI DetailsList - Is there a way to add filters to each ...
Inside your column definition, set the hasDropdown action so the user ... into the items collection so the user can select one to...
Read more >React Data Grid: Rendering
From inside Plunker, open in a new tab. Open React Developer Tools. We do not advise using the React Developer Tools on the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I believe this is an issue in the underlying web components. Have raised an issue there,
@ehsangfl More info here: https://learn.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation?view=aspnetcore-7.0