网站建设包括哪些服务,百家联盟推广部电话多少,软装设计师是干什么的,免费建网站系统page /virtualScrolling
using BlazorApp.Datah3Table 虚拟滚动行/h3
h4Table 组件显示大数据时通常采用分页加载数据#xff0c;还有一种虚拟行的技术类似手机滚动到底部时后台自动加载数据/h4p快速滚动时显示行占位page /virtualScrolling
using BlazorApp.Datah3Table 虚拟滚动行/h3
h4Table 组件显示大数据时通常采用分页加载数据还有一种虚拟行的技术类似手机滚动到底部时后台自动加载数据/h4p快速滚动时显示行占位提升用户体验/ppPageItems:设置页大小Height:设置Table的高度ScrollModeScrollMode.Virtual开启虚拟滚动功能/pp当前页大小 PageCount/pTable TItemFoo Height300 PageItems20 IsBorderedtrue IsStripedtrue ScrollModeScrollMode.Virtual OnQueryAsyncOnQueryAsyncTableColumnsTableColumn bind-Fieldcontext.DateTime Width180 /TableColumn bind-Fieldcontext.Name /TableColumn bind-Fieldcontext.Address Readonlytrue /TableColumn bind-Fieldcontext.Education /TableColumn bind-Fieldcontext.Count Editablefalse /TableColumn bind-Fieldcontext.Complete //TableColumns
/Table
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using System.Net.Http;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Components.Routing;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.Web.Virtualization;
using Microsoft.JSInterop;
using BlazorApp;
using BlazorApp.Shared;
using BootstrapBlazor.Components;
using BlazorApp.Data;
using System.Diagnostics.CodeAnalysis;namespace BlazorApp.Pages
{public partial class VirtualScrolling{[NotNull]private ListFoo? DBList { get; set; }[NotNull]private int PageCount { get; set; }/// summary/// OnInitialized/// /summaryprotected override void OnInitialized(){base.OnInitialized();//模拟数据库DBList Foo.GenerateFoo(10000);}private async TaskQueryDataFoo OnQueryAsync(QueryPageOptions options){//控制加载数据避免卡死await Task.Delay(200);//从数据库读取分页的总数int count DBList.Count;//分页获取var items DBList.Skip(options.StartIndex).Take(options.PageItems);PageCount options.PageItems;//异步方法需要主动调用这个方法告诉前台Blazor的状态已经改变StateHasChanged();return new QueryDataFoo(){Items items,TotalCount count};}}
}