How to go back to previous pagination page?

UI Components for Angular
Post Reply
Posts: 1
Joined: 14 Mar 2019, 15:42

14 Mar 2019, 16:10

In my HTML I have a p-table that has [paginator]="true" and a (onPAge)="paginate($event)" that is called from the type script file to get [first] pagination page along with [rows]. These Table attribute values (first and rows) are passed on to another page through router.navigate(url path, queryParms). When the user clicks Cancel button off the page I need the paginator to set itself to previous pagination page instead of reseting pagination [first] back to "0". In my Type script I have a "this.setPaginationPage(Number(this.previousPage), Number(this.previousRows)) that is called in my ngOnInit() method. So, in this method what do I need to do to get paginator to set back to previous page and rows? Any help would be appreciated.


* Method to capture pagination page
{ = event.first;
this.rows = event.rows;
console.log('currentPaginationPage = first: ' + + ' rows: ' + this.rows);

* Method to set previous pagination page
@ViewChild('dt') table: Table;
setPaginationPage(p: number, r: number)
let paging = {
first: p,
rows: r

// reset pagination
// this.table.reset();
console.log('previousPaginationPage = first: ' + paging.first + ' rows: ' + paging.rows);

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests