Skip to content
Merged
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -4885,7 +4885,7 @@
"Affix": "Affix",
"Watermark": "Watermark",
"OctIcon": "Oct Icons",
"UniverIcons": "Univer Icons",
"UniverIcon": "Univer Icons",
"Typed": "Typed",
"UniverSheet": "UniverSheet"
},
Expand Down
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/Components/Table/Table.razor
Original file line number Diff line number Diff line change
Expand Up @@ -369,13 +369,13 @@
{
@if (Items != null)
{
<Virtualize ItemSize="RowHeight" OverscanCount="10" Items="@Items.ToList()" ChildContent="RenderRow">
<Virtualize ItemSize="RowHeight" OverscanCount="@OverscanCount" Items="@Items.ToList()" ChildContent="RenderRow">
</Virtualize>
}
else
{
<Virtualize @ref="_virtualizeElement"
ItemSize="RowHeight" OverscanCount="10" Placeholder="RenderPlaceholderRow"
ItemSize="RowHeight" OverscanCount="@OverscanCount" Placeholder="RenderPlaceholderRow"
ItemsProvider="LoadItems" ItemContent="RenderRow">
</Virtualize>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ public partial class Table<TItem>
/// <summary>
/// 获得/设置 树形数据集合
/// </summary>
[NotNull]
private List<TableTreeNode<TItem>> TreeRows { get; } = new(100);

/// <summary>
Expand Down Expand Up @@ -121,6 +120,7 @@ private async Task<IEnumerable<IExpandableNode<TItem>>> GetChildrenRowAsync(Tabl
{
throw new InvalidOperationException(NotSetOnTreeExpandErrorMessage);
}

return await OnTreeExpand(node.Value);
}
}
7 changes: 7 additions & 0 deletions src/BootstrapBlazor/Components/Table/Table.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,13 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName(
[Parameter]
public float RowHeight { get; set; } = 38f;

/// <summary>
/// Gets or sets the overscan count for virtual scrolling. Default is 10.
/// </summary>
/// <remarks>Effective when <see cref="ScrollMode"/> is set to <see cref="ScrollMode.Virtual"/>.</remarks>
[Parameter]
public int OverscanCount { get; set; } = 10;

[Inject]
[NotNull]
private IOptionsMonitor<BootstrapBlazorOptions>? Options { get; set; }
Expand Down
1 change: 1 addition & 0 deletions test/UnitTest/Components/TableTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2104,6 +2104,7 @@ public void IsFixedFooter_Ok()
pb.Add(a => a.RenderMode, TableRenderMode.Table);
pb.Add(a => a.ScrollMode, ScrollMode.Virtual);
pb.Add(a => a.RowHeight, 39.5f);
pb.Add(a => a.OverscanCount, 10);
pb.Add(a => a.ShowFooter, true);
pb.Add(a => a.IsFixedFooter, true);
pb.Add(a => a.Items, Foo.GenerateFoo(localizer));
Expand Down