Fixed changing pages and stuff
This commit is contained in:
parent
9430642b5d
commit
76bb80d159
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/ng-datatable",
|
"name": "@ztimson/ng-datatable",
|
||||||
"version": "1.7.0",
|
"version": "1.7.1",
|
||||||
"homepage": "https://github.com/ztimson/ng-datatable",
|
"homepage": "https://github.com/ztimson/ng-datatable",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -79,9 +79,8 @@ export class NgDatatableComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(this.paginate && this.processedData) {
|
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.pages = Array(Math.ceil(this.processedData.length / this.pageLength)).fill(0).map((ignore, i) => i + 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);
|
this.pagedData = this.processedData.filter((ignore, i) => i >= (this.page - 1) * this.pageLength && i < this.page * this.pageLength);
|
||||||
} else {
|
} else {
|
||||||
this.pagedData = this.processedData;
|
this.pagedData = this.processedData;
|
||||||
|
Loading…
Reference in New Issue
Block a user