angular / angular/components

[Table] MatTableDataSource constructor should include MatSort, MatPaginator

Open
#8,520 7 comments 13 reactions 0 assignees View on GitHub
area: material/table feature needs: discussion P3
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?
Have a constructor that, at least optionally, takes a MatSort and/or a MatPaginator as parameters.

#### What is the current behavior?
Currently, you have to create a new MatTableDataSource with only data as a parameter. However, you always have to set the matSort and paginator of the MatTableDataSource after construction. I had to make a class that extends this class to have this, which seems superfluous.

#### What are the steps to reproduce?

#### What is the use-case or motivation for changing an existing behavior?
To make the creation of MatTableDataSources easier.

#### Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular: 5.0.1
Material: 5.0.0-rc0
OS: Windows 10 Pro
TypeScript: 2.6.1
Browser: Google Chrome 62.0.3202.94 (Official Build) (64-bit)
#### Is there anything else we should know?

Contributor guide

Open the contributing guide

Research direction

Start by locating the MatTableDataSource entry point and its existing tests, then inspect how MatSort and MatPaginator are currently assigned after construction. Done means the constructor optionally accepts those objects and tests cover construction with each supported combination.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.