Skip to content

Commit

Permalink
fixed #588 [HxGrid] Data never gets loaded when using PlaceholdersRow…
Browse files Browse the repository at this point in the history
…Count together with InfiniteScroll mode
  • Loading branch information
hakenr committed Oct 12, 2023
1 parent e6258c5 commit 86945be
Showing 1 changed file with 57 additions and 57 deletions.
114 changes: 57 additions & 57 deletions Havit.Blazor.Components.Web.Bootstrap/Grids/HxGrid.razor
Original file line number Diff line number Diff line change
Expand Up @@ -95,63 +95,6 @@
</tr>
</thead>
<tbody>
@if (shouldRenderLoadingData)
{
@if (shouldRenderLoadingDataWithPlaceholders)
{
int rowsToRender = PlaceholdersRowCountEffective;
int pageOffset = CurrentUserState.PageIndex * PageSizeEffective;

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>
}
}
else
{
<tr>
<td colspan="@columnsToRender.Count">
@if (shouldRenderLoadingDataWithLoadingTemplate)
{
@LoadingDataTemplate
}
else
{
<div class="text-center text-secondary my-5">
<div class="fs-3"><HxIcon Icon="@BootstrapIcon.InboxFill" /></div>
<div>@HxGridLocalizer["LoadingData"]</div>
</div>
}
</td>
</tr>
}
}
@if (shouldRenderEmptyData)
{
<tr class="hx-grid-empty-data-row">
<td colspan="@columnsToRender.Count">

@if (EmptyDataTemplate != null)
{
@EmptyDataTemplate
}
else
{
<HxGridEmptyDataTemplateDefaultContent />
}

</td>
</tr>
}
@if (shouldRenderData)
{

Expand Down Expand Up @@ -226,6 +169,63 @@
@rowTemplate(item)
}
}
@if (shouldRenderLoadingData)
{
@if (shouldRenderLoadingDataWithPlaceholders)
{
int rowsToRender = PlaceholdersRowCountEffective;
int pageOffset = CurrentUserState.PageIndex * PageSizeEffective;

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>
}
}
else
{
<tr>
<td colspan="@columnsToRender.Count">
@if (shouldRenderLoadingDataWithLoadingTemplate)
{
@LoadingDataTemplate
}
else
{
<div class="text-center text-secondary my-5">
<div class="fs-3"><HxIcon Icon="@BootstrapIcon.InboxFill" /></div>
<div>@HxGridLocalizer["LoadingData"]</div>
</div>
}
</td>
</tr>
}
}
@if (shouldRenderEmptyData)
{
<tr class="hx-grid-empty-data-row">
<td colspan="@columnsToRender.Count">

@if (EmptyDataTemplate != null)
{
@EmptyDataTemplate
}
else
{
<HxGridEmptyDataTemplateDefaultContent />
}

</td>
</tr>
}
}
</tbody>
@{
Expand Down

0 comments on commit 86945be

Please sign in to comment.