angular / angular/components

[Table] Expose paginated data on MatTableDataSource

Open
#9,419 6 comments 1 reaction 0 assignees View on GitHub
area: material/table feature P4
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

#### 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?
--

Contributor guide

Open the contributing guide

Research direction

Start at MatTableDataSource and inspect how its filtered, sorted, and paginated rendered data is currently exposed, including the private _renderData BehaviorSubject mentioned in the report. Compare the existing public APIs and define a documented way to retrieve the current page; done means consumers no longer need private-property access.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.