microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications

Home Page:https://www.fluentui-blazor.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fix: Clicking content in the DataGrid's empty content throws an exception

joriverm opened this issue Β· comments

πŸ› Bug Report

when adding an interactive component inside the empty row content, and clicking it webcomponents will throw an error saying it can't find the row because the empty row does not contain an id.

πŸ’» Repro or Code Sample

in the example code i replaced the Intermittent loading example of the datagrid to have a button in its content when empty :

<div style="height: 400px; overflow-y: scroll;">
    <FluentDataGrid @ref="grid" Items=@items GridTemplateColumns="1fr 1fr 1fr 1fr" Style="height: 100%;">
        <ChildContent>
            <PropertyColumn Property="@(c => c.Item1)" Sortable="true" />
            <PropertyColumn Property="@(c => c.Item2)" />
            <PropertyColumn Property="@(c => c.Item3)" Align="Align.Center" />
            <PropertyColumn Property="@(c => c.Item4)" Align="Align.End" />
        </ChildContent>
        <EmptyContent>
            <FluentButton IconStart="@(new Icons.Filled.Size24.Crown())">&nbsp; Nothing to see here. Carry on!</FluentButton>
        </EmptyContent>
    </FluentDataGrid>
</div>

πŸ€” Expected Behavior

nothing to happen besides the button click

😯 Current Behavior

the click event happens, but webcomponents throws an error :
image

πŸ’ Possible Solution

giving the empty-content-row an id prevents the webcomponents from throwing an exception. PR is incoming

πŸ”¦ Context

the issue has no effect on our code, but it shouldn't throw an error imo. this just fixes it so we don't think anything is wrong in our client code :)

🌍 Your Environment

  • OS & Device: Windows 10 / PC
  • Browser: Mozilla FireFox
  • .NET and Fluent UI Blazor library Version: 4.7.1