Reset page number on reprocess

This commit is contained in:
Zakary Timson 2018-06-28 19:16:48 -04:00
parent d544581b0e
commit 7ee1eda2f0
2 changed files with 3 additions and 1 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@ztimson/ng-datatable",
"version": "1.6.8",
"version": "1.7.0",
"homepage": "https://github.com/ztimson/ng-datatable",
"license": "Apache-2.0",
"author": {

View File

@ -76,6 +76,8 @@ export class NgDatatableComponent implements OnInit {
}
if(this.paginate && this.processedData) {
this.page = 1;
this.pageChanged.emit(this.page);
this.pages = Array(Math.ceil(this.processedData.length / this.pageLength)).fill(0).map((ignore, i) => i + 1);
this.pagedData = this.processedData.filter((ignore, i) => i >= (this.page - 1) * this.pageLength && i < this.page * this.pageLength);
} else {