Blazor WebAssembly Dev Express 数据网格 - 无需分页即可加载所有行

问题描述

我开始在一个项目中尝试使用 devexpress Blazor Grid 组件,该项目正在从 Webforms 迁移到 Blazor WebAssembly。
我看到网格中的分页组件工作得很好。
但是我有这样的要求来加载所有记录而没有分页并且很难获得正确的设置

<DxDataGrid DataAsync="@GetEmployeeStatssAsync" WIDTH="700px"     VerticalScrollBarMode="ScrollBarMode.Auto" 
VerticalScrollableHeight="200">
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.FullName)" Width="30px"  />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.Batches)" Width="30px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.Lines)" Width="20px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.Units)"  Width="20px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.Hours)"  Width="30px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.LPH)"  Width="30px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.Errors)"  Width="30px" />
<DxDataGridColumn Field="@nameof(EmployeeStatResponse.EPer)"  Width="30px" />
</DxDataGrid>

我尝试将 pagesize 设置为 10,000,但是当我这样做时屏幕冻结。

<DxDataGrid DataAsync="@GetEmployeeStatssAsync(51)" WIDTH="700px" PageSize="10000"
            VerticalScrollBarMode="ScrollBarMode.Auto" 
            VerticalScrollableHeight="200">

请告诉我什么是正确的实施方式

提前致谢。

解决方法

您可以使用 DxDataGrid 的 ShowPager、PagerAllDataRowsItemVisible、PageSize 属性

<DxDataGrid Data="@employees" ShowPager="false" PagerAllDataRowsItemVisible="false" PageSize="10000">
        <DxDataGridColumn Field="Id" AllowSort="false" Width="50px"/>
        <DxDataGridColumn Field="Name" AllowSort="false" Width="50px"/>
        <DxDataGridColumn Field="PhoneNumber" AllowSort="false" Width="50px"/>
</DxDataGrid>

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...