Skip to content

bug(table): 虚拟滚动模式, 搜索后会卡在骨架屏界面 #5085

@densen2014

Description

@densen2014

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

虚拟滚动模式, 搜索后会卡在骨架屏界面

复现步骤

  1. 搜索输入 0035 回车, (搜索一个不在第一页的数据)
  2. 按Esc

另一种复现步骤

  1. 搜索0035

  2. 搜索一个不存在的记录
    搜索这和个关键字,其实没有结果,他还是渲染了骨架屏
    5b38532ccd11ea988cf4b7d0b2c4bfe0

  3. 再次搜索关键字00
    会有很多条结果, 但是搜索后, 会卡住在骨架屏界面, 也可能只显示一条, 也有几率显示全部, 如果卡在这里,要再次点击搜索按钮才能刷新出来真正的结果
    309f00debbf15d0445e1a7bb7344b1a9

Expected Behavior

<DemoBlock Title="@Localizer["VirtualizationDynamicTitle"]"
           Introduction="@Localizer["VirtualizationDynamicIntro"]"
           Name="Dynamic">
    <section ignore>@Localizer["VirtualizationDynamicDescription"]</section>
    <Table TItem="Foo" class="table-virtualize-demo"
           IsBordered="true" IsStriped="true"
           ShowToolbar
           ShowSearch
           ShowAdvancedSearch="false"
           ScrollMode="ScrollMode.Virtual" OnQueryAsync="OnQueryAsync">
        <TableColumns>
            <TableColumn @bind-Field="@context.DateTime" Width="180" />
            <TableColumn @bind-Field="@context.Name" />
            <TableColumn @bind-Field="@context.Address" Readonly="true" />
            <TableColumn @bind-Field="@context.Education" />
            <TableColumn @bind-Field="@context.Count" />
            <TableColumn @bind-Field="@context.Complete" />
        </TableColumns>
    </Table>
</DemoBlock>
    
    private async Task<QueryData<Foo>> OnQueryAsync(QueryPageOptions options)
    {
        await Task.Delay(200);
        // 搜索
        var items = options.SearchText!=null? Items.Where(a=>a.Name!.Contains(options.SearchText)) : Items;
        // 获得搜索后的记录总数
        var count = items.Count();
        // 内存分页
        if (options.IsPage)
        {
            items = items.Skip((options.PageIndex - 1) * options.PageItems).Take(options.PageItems);
        }
        else if (options.IsVirtualScroll)
        {
            items = items.Skip(options.StartIndex).Take(options.PageItems);
        }

        return new QueryData<Foo>()
        {
            Items = items,
            TotalCount = count
        };
    }

Interactive render mode

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

Steps To Reproduce

解压替换文档文件 \BootstrapBlazor\src\BootstrapBlazor.Server\Components\Samples\Table

Table.zip

Exceptions (if any)

No response

.NET Version

NET9.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions