【发布时间】:2021-04-23 16:08:11
【问题描述】:
我正在尝试实现一个带有分页的 Angular 材料表,它连接到后端,从 Azure 表存储中检索数据。
我知道,Table Storage 支持ExecuteQuerySegmentedAsync,它返回TableContinuationToken。看起来不错。所以在前端,我得到这样的东西:
interface IPagedResult<T> {
items: T[];
isFinalPage: boolean;
continuationToken: string;
}
interface ILog {
enqueuedDate: string;
...
}
component.ts 中的某处:
private logsTableSource: MatTableDataSource<ILog>;
@ViewChild(MatPaginator)paginator: MatPaginator;
ngAfterViewInit() {
myService.GetRecords(this.paginator.pageSize)
.subscribe(
(res: IPagedResult<ILog>) => {
this.logsTableSource = new MatTableDataSource<ILog>(res.items);
});
}
现在我想知道,如何获取页数?并让服务器知道我想要什么具体的页面?
事实上,我可以用这个 continuationToken 做什么?
【问题讨论】:
标签: angular angular-material azure-table-storage azure-tablequery mat-pagination