Default to first page

This commit is contained in:
Zakary Timson 2018-07-03 14:42:10 -04:00
parent 2258c12b56
commit f21e120e00
2 changed files with 2 additions and 1 deletions

View File

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

View File

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