angular / angular/components

[Table] Expose paginated data on MatTableDataSource

未关闭
#9,419 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
area: material/table feature P4
主要语言
TypeScript
星标
25k
派生
6.8k
平均合并
1 天 8 小时
30 天内合并 PR
91

描述

#### Bug, feature request, or proposal:
feature request

#### What is the expected behavior?
`MatTableDataSource` should provide a method to get currently rendered data which is filtered, sorted and paginated.

#### What is the current behavior?
At the moment I couldn't find the right way to get rendered data(It may exist but it's not documented).

#### What are the steps to reproduce?
--

#### What is the use-case or motivation for changing an existing behavior?
I have found a hacky way to get currently rendered data on the table page.
The data is filtered, sorted, and paginated, so I have to get the currently visible data, for let's say row selection's page toggle(clicking it will select all filtered and sorted data on the current table page).

I'm using `this.dataSource['_renderData']['value']`, but the problem is that, `_renderData` is a `private` property of type `BehaviorSubject`. So accessing data in this way doesn't look good.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
latest

#### Is there anything else we should know?
--

贡献指南

打开贡献指南

调研方向

从 MatTableDataSource 开始,检查其经过过滤、排序和分页的渲染数据目前是如何公开的,包括报告中提到的私有 _renderData BehaviorSubject。比较现有的公共 API,并定义一种有文档说明的方式来获取当前页面;完成的标准是使用者不再需要访问私有属性。

由索引模型根据 Issue 内容生成。

评估

技术栈
angular, typescript
领域
frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。