Skip to content

bug(table): 表格开启虚拟滚动,数据加载问题 #8065

@densen2014

Description

@densen2014

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

表格开启虚拟滚动, 数据服务查询会走两次. 这个问题其实一直都存在, 可能官方虚拟滚动就得两次来计算高度

<Table TItem="Foo" AutoGenerateColumns="true" class="table-demo"
       IsPagination="true" PageItemsSource="PageItemsSource"
       IsStriped="true" IsBordered="true"IsMultipleSelect="true"
       ShowSkeleton="true" ShowToolbar="true" ShowSearch="true" ShowExtendButtons="true"
       ShowExportButton="true" ShowExportPdfButton="true"
       ScrollMode="ScrollMode.Virtual"
       Height="600"
       IsFixedHeader="true"
       PageItems="20"
       OnQueryAsync="OnQueryAsync" OnSaveAsync="OnSaveAsync" OnDeleteAsync="OnDeleteAsync">
    <TableColumns>
        <TableColumn @bind-Field="@context.Hobby" Items="GetHobbies(context)" />
    </TableColumns>
</Table>


    private Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
    {
        System.Console.WriteLine($"{DateTime.Now:O} * OnQueryAsync StartIndex:{options.StartIndex} PageIndex:{options.PageIndex}");
        ....
     }

输出

2026-05-29T11:01:34.3178018+02:00 * OnQueryAsync StartIndex:0 PageIndex:1
2026-05-29T11:01:34.3986865+02:00 * OnQueryAsync StartIndex:0 PageIndex:1

断点

Image

Expected Behavior

Interactive render mode

Interactive Server (Interactive server-side rendering (interactive SSR) using Blazor Server)

Steps To Reproduce

例子.zip

8065.zip

Exceptions (if any)

No response

.NET Version

NET8/9/10

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions