Open XPhilipp opened 10 months ago
Hopefully this one gets some attention. I don't have time right now to investigate a proper solution or workaround, but it looks like it may be related to these areas of MudDataGrid: `@if (ChildRowContent != null && (_openHierarchies.Contains(item) || !hasHierarchyColumn)) {
}`
Where ChildRowContent is never null when you've added it to your data grid, even if you don't pass anything into it. The RenderFragment is still instantiated, even without content. In my situation, shared below, even when the if statement is false here, the row is rendered as an empty row.
`@if (context.Item.IsExpanded && context.Item.DynamicComponentType != null) {
}`
If someone has a workaround to this, please let me know.
Hi.
The thing is that in Blazor there is no API to know if the RenderFragment
has an empty content or that it's currently not rending it's content because of the condition
That's why when you declare the ChildRowContent
the RenderFragment
is not null
anymore.
And this part is getting invoked
https://github.com/MudBlazor/MudBlazor/blob/0824b2135c504fcd74798acca6b53c429b4fbb14/src/MudBlazor/Components/DataGrid/MudDataGrid.razor#L251-L258
The applied mud-table-cell
style is what causing this "empty" line to show up.
I think the main idea behind ChildRowContent
was that you either have always some content, or you have like a toggle button inside that will hide/show content.
As workaround you could do something like this: https://try.mudblazor.com/snippet/cEQeEnFQywritWmt Usually, I strongly don't recommend doing this in Blazor, but I don't have anything else to offer.
Also, this is not really correct:
@if (!_isReadOnly)
{
<HierarchyColumn T="Element" ButtonDisabledFunc="@(x => x.Sign == "He")" />
}
As every time this changes _isReadOnly
you will add a new reference to the RenderColumns
and in will duplicate, please read this: https://github.com/MudBlazor/MudBlazor/issues/6569#issuecomment-1493373386.
Here's a small workaround I've come up with. https://try.mudblazor.com/snippet/QawSkycHrvmLqJfT
Only catch is that the :has()
pseudo-class is only standard in browsers as of December 2023, so if you can't guarantee that your users have up-to-date browsers I imagine you could easily do something similar using JS interop.
Bug type
Component
Component name
MudDataGrid
What happened?
If you programmatically define "Row Detail View", then an empty ChildRowContent leads to a visual bug - empty lines between the grid lines
Expected behavior
Normal representation without extra blank lines
Reproduction link
https://try.mudblazor.com/snippet/cEGRvakRBFncGGKm
Reproduction steps
Relevant log output
No response
Version (bug)
6.10.0
Version (working)
No response
What browsers are you seeing the problem on?
Chrome
On what operating system are you experiencing the issue?
Windows
Pull Request
Code of Conduct