Prevent pagination until there is data
This commit is contained in:
parent
0fb93f723e
commit
feda2b6c53
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/ng-datatable",
|
"name": "@ztimson/ng-datatable",
|
||||||
"version": "1.6.6",
|
"version": "1.6.7",
|
||||||
"homepage": "https://github.com/ztimson/ng-datatable",
|
"homepage": "https://github.com/ztimson/ng-datatable",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -75,7 +75,7 @@ export class NgDatatableComponent implements OnInit {
|
|||||||
if (this.sortedDesc) this.processedData = this.processedData.reverse();
|
if (this.sortedDesc) this.processedData = this.processedData.reverse();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.paginate) {
|
if(this.paginate && this.processedData) {
|
||||||
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);
|
||||||
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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user