Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(table): not re-rendering when switching to a smaller set of data than the current page #14665

Merged

Conversation

crisbeto
Copy link
Member

Fixes the table not rendering correctly when going from a large set of data (e.g. 50 items and on page 10) to a small set of items (e.g. 1 item). The issue comes from the fact that the paginator doesn't emit events if they weren't generated by the user (see discussion on #12586).

Fixes #14010.

@crisbeto crisbeto added the target: patch This PR is targeted for the next patch release label Dec 28, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Dec 28, 2018
…than the current page

Fixes the table not rendering correctly when going from a large set of data (e.g. 50 items and on page 10) to a small set of items (e.g. 1 item). The issue comes from the fact that the paginator doesn't emit events if they weren't generated by the user (see discussion on angular#12586).

Fixes angular#14010.
@crisbeto crisbeto force-pushed the 14010/table-paginator-smaller-data branch from 07849e4 to 68c9d8c Compare December 28, 2018 15:48
@andrewseguin andrewseguin added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Jan 9, 2019
@@ -276,14 +280,24 @@ export class MatTableDataSource<T> extends DataSource<T> {
*/
_updatePaginator(filteredDataLength: number) {
Promise.resolve().then(() => {
if (!this.paginator) { return; }
const paginator = this.paginator;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we creating a new const for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were using this.paginator in 4-5 different places. I moved it out into a const because it minifies better.

@vivian-hu-zz vivian-hu-zz merged commit a31a2ff into angular:master Jan 16, 2019
s2-abdo pushed a commit to s2-abdo/material2 that referenced this pull request Jan 18, 2019
…than the current page (angular#14665)

Fixes the table not rendering correctly when going from a large set of data (e.g. 50 items and on page 10) to a small set of items (e.g. 1 item). The issue comes from the fact that the paginator doesn't emit events if they weren't generated by the user (see discussion on angular#12586).

Fixes angular#14010.
s2-abdo pushed a commit to s2-abdo/material2 that referenced this pull request Jan 18, 2019
…than the current page (angular#14665)

Fixes the table not rendering correctly when going from a large set of data (e.g. 50 items and on page 10) to a small set of items (e.g. 1 item). The issue comes from the fact that the paginator doesn't emit events if they weren't generated by the user (see discussion on angular#12586).

Fixes angular#14010.
vivian-hu-zz pushed a commit that referenced this pull request Jan 18, 2019
…than the current page (#14665)

Fixes the table not rendering correctly when going from a large set of data (e.g. 50 items and on page 10) to a small set of items (e.g. 1 item). The issue comes from the fact that the paginator doesn't emit events if they weren't generated by the user (see discussion on #12586).

Fixes #14010.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MatTableDataSource with Pagination does not update with data change less than paginator's index
5 participants