Skip to content

Commit dd15c59

Browse files
committed
feat: 增加 OverscanCount 参数
1 parent 0c234b2 commit dd15c59

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/BootstrapBlazor/Components/Table/Table.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,13 @@
369369
{
370370
@if (Items != null)
371371
{
372-
<Virtualize ItemSize="RowHeight" OverscanCount="10" Items="@Items.ToList()" ChildContent="RenderRow">
372+
<Virtualize ItemSize="RowHeight" OverscanCount="@OverscanCount" Items="@Items.ToList()" ChildContent="RenderRow">
373373
</Virtualize>
374374
}
375375
else
376376
{
377377
<Virtualize @ref="_virtualizeElement"
378-
ItemSize="RowHeight" OverscanCount="10" Placeholder="RenderPlaceholderRow"
378+
ItemSize="RowHeight" OverscanCount="@OverscanCount" Placeholder="RenderPlaceholderRow"
379379
ItemsProvider="LoadItems" ItemContent="RenderRow">
380380
</Virtualize>
381381
}

src/BootstrapBlazor/Components/Table/Table.razor.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,13 @@ private string GetSortTooltip(ITableColumn col) => SortName != col.GetFieldName(
370370
[Parameter]
371371
public float RowHeight { get; set; } = 38f;
372372

373+
/// <summary>
374+
/// Gets or sets the overscan count for virtual scrolling. Default is 10.
375+
/// </summary>
376+
/// <remarks>Effective when <see cref="ScrollMode"/> is set to <see cref="ScrollMode.Virtual"/>.</remarks>
377+
[Parameter]
378+
public int OverscanCount { get; set; } = 10;
379+
373380
[Inject]
374381
[NotNull]
375382
private IOptionsMonitor<BootstrapBlazorOptions>? Options { get; set; }

0 commit comments

Comments
 (0)