-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
How can I set pageIndex of paginator and it can update itself? #6220
Comments
public onSubmit(): void {
const firstPage: number = this.pageIndex + 1;
this.paginator.pageIndex = 0;
this.diseaseDataBase.getDiseasesByPage(this.keyword, firstPage);
} first submit, the keyword is But when I submit again with the same keyword |
Fixed by #5822 |
@andrewseguin I don't think it has been fixed. If you can test it to see. I took a look for the source code of /** The zero-based page index of the displayed list of items. Defaulted to 0. */
@Input()
get pageIndex(): number { return this._pageIndex; }
set pageIndex(pageIndex: number) {
this._pageIndex = pageIndex;
this._changeDetectorRef.markForCheck();
}
_pageIndex: number = 0; I found |
@willshowell oh. That's the reason. when is the next release ? |
hy. I have same problem too. Sorry guys, but |
Full solution: You need to declare paginator dom element as variable using
Then set every time you need to set
|
I do have done everything that you guys have been talking about. But when I set my component like this <mat-paginator #paginator> And in the component test() { And when the page loads appears something like this: Items per page: And when I click the button, this appears: tems per page: It seems that the pageIndex was updated but the data of the table is not refreshed, please any help would be appreciated |
@dfhincapiem see #8417, this is a known issue from over a year ago and I'm kind of amazed it hasn't been fixed yet. There is a hack / workaround described in that issue. |
I made load more instead of paginator for my project needs.
Basically |
MatPaginator contains method to move to the first page.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
proposal
What is the expected behavior?
For example. When the paginator display
11-20 of 400
, I want to set thepageIndex
to initial state. And after that, I want paginator display1-10 of 400
.What is the current behavior?
First page is 0 and current page is 1, the paginator view display
11-20 of 400
.I set the
pageIndex
to initial state like this:But the view of paginator not update. Still display
11-20 of 400
.Which versions of Angular, Material, OS, TypeScript, browsers are affected?
"@angular/core": "^4.3.1",
"@angular/material": "^2.0.0-beta.8",
The text was updated successfully, but these errors were encountered: