Skip to content

Commit

Permalink
[HxGrid] Placeholders do not use ItemCssClass
Browse files Browse the repository at this point in the history
  • Loading branch information
Harvey1214 committed Jul 1, 2024
1 parent 5a1fb4f commit c54a0d0
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@namespace Havit.Blazor.Components.Web.Bootstrap
@using Havit.Blazor.Components.Web.Bootstrap.Internal
@using Microsoft.AspNetCore.Components.Web.Virtualization;
@typeparam TItem

<CascadingValue Value="@_columnsListRegistration" Name="@ColumnsRegistrationCascadingValueName" IsFixed="true">
Expand Down Expand Up @@ -151,22 +152,30 @@
}
</text>;

RenderFragment<PlaceholderContext> placeholderRowTemplate = (PlaceholderContext context) =>
@<tr @key="@context.Index"
height="@((ContentNavigationModeEffective == GridContentNavigationMode.InfiniteScroll) ? rowHeight : null)"
class="@ItemRowCssClassEffective"
@onclick:stopPropagation>

@foreach (IHxGridColumn<TItem> column in columnsToRender)
{
// same as above this else section
GridCellTemplate cellTemplate = column.GetItemPlaceholderCellTemplate(new GridPlaceholderCellContext { Index = context.Index });
<td @key="@column" class="@cellTemplate.CssClass">
@cellTemplate.Template
</td>
}
</tr>;

@if (ContentNavigationModeEffective == GridContentNavigationMode.InfiniteScroll)
{
<Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize TItem="TItem" @ref="_infiniteScrollVirtualizeComponent" ItemsProvider="VirtualizeItemsProvider" ItemSize="@ItemRowHeightEffective" OverscanCount="@OverscanCountEffective" SpacerElement="tr">
<ItemContent>
@rowTemplate(@context)
@rowTemplate(context)
</ItemContent>
<Placeholder Context="placeholderContext">
<tr height="@rowHeight">
@foreach (IHxGridColumn<TItem> column in columnsToRender)
{
GridCellTemplate placeholderCellTemplate = column.GetItemPlaceholderCellTemplate(new GridPlaceholderCellContext { Index = placeholderContext.Index });
<td @key="@column" class="@placeholderCellTemplate.CssClass">
@placeholderCellTemplate.Template
</td>
}
</tr>
@placeholderRowTemplate(placeholderContext)
</Placeholder>
</Microsoft.AspNetCore.Components.Web.Virtualization.Virtualize>
}
Expand All @@ -189,15 +198,7 @@
for (int i = 0; i < rowsToRender; i++)
{
GridPlaceholderCellContext placeholderContext = new GridPlaceholderCellContext { Index = pageOffset + i };
<tr>
@foreach (IHxGridColumn<TItem> column in columnsToRender)
{
GridCellTemplate placeholderCellTemplate = column.GetItemPlaceholderCellTemplate(placeholderContext);
<td @key="@column" class="@placeholderCellTemplate.CssClass">
@placeholderCellTemplate.Template
</td>
}
</tr>
@placeholderRowTemplate(placeholderContext)

Check failure on line 201 in Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor

View workflow job for this annotation

GitHub Actions / build

The name 'placeholderRowTemplate' does not exist in the current context

Check failure on line 201 in Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor

View workflow job for this annotation

GitHub Actions / build

The name 'placeholderRowTemplate' does not exist in the current context

Check failure on line 201 in Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor

View workflow job for this annotation

GitHub Actions / build

The name 'placeholderRowTemplate' does not exist in the current context

Check failure on line 201 in Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor

View workflow job for this annotation

GitHub Actions / build

The name 'placeholderRowTemplate' does not exist in the current context
}
}
else
Expand Down

0 comments on commit c54a0d0

Please sign in to comment.