From c54a0d0b3426e13cf1acabdc1aef86ad1cbd2cde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikul=C3=A1=C5=A1=20Hobl=C3=ADk?= Date: Mon, 1 Jul 2024 14:54:41 +0200 Subject: [PATCH] [HxGrid] Placeholders do not use ItemCssClass --- .../Grids/HxGrid.razor | 39 ++++++++++--------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor b/Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor index a80bfef3..4122bfe7 100644 --- a/Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor +++ b/Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor @@ -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 @@ -151,22 +152,30 @@ } ; + RenderFragment placeholderRowTemplate = (PlaceholderContext context) => + @ + + @foreach (IHxGridColumn column in columnsToRender) + { + // same as above this else section + GridCellTemplate cellTemplate = column.GetItemPlaceholderCellTemplate(new GridPlaceholderCellContext { Index = context.Index }); + + @cellTemplate.Template + + } + ; + @if (ContentNavigationModeEffective == GridContentNavigationMode.InfiniteScroll) { - @rowTemplate(@context) + @rowTemplate(context) - - @foreach (IHxGridColumn column in columnsToRender) - { - GridCellTemplate placeholderCellTemplate = column.GetItemPlaceholderCellTemplate(new GridPlaceholderCellContext { Index = placeholderContext.Index }); - - @placeholderCellTemplate.Template - - } - + @placeholderRowTemplate(placeholderContext) } @@ -189,15 +198,7 @@ for (int i = 0; i < rowsToRender; i++) { GridPlaceholderCellContext placeholderContext = new GridPlaceholderCellContext { Index = pageOffset + i }; - - @foreach (IHxGridColumn column in columnsToRender) - { - GridCellTemplate placeholderCellTemplate = column.GetItemPlaceholderCellTemplate(placeholderContext); - - @placeholderCellTemplate.Template - - } - + @placeholderRowTemplate(placeholderContext) } } else