Skip to content

Commit 275ab4c

Browse files
committed
fix(*): prevent the grid's current page to become a negative number
1 parent d51141d commit 275ab4c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/app/grid/grid-batchEditing-remotePaging/batch-editing-remote-paging.component.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ export class RemotePagingBatchEditingComponent implements OnInit, AfterViewInit,
6868
const skipEl = this._totalPagesOnServer * this.perPage;
6969
this.remoteService.getData(skipEl, skipEl + this.perPage);
7070
}
71+
this.grid1.isLoading = false;
7172
this.grid1.paginator.page = page - this._totalPagesOnServer;
7273
this.page = page;
7374
return;
74-
} else {
75-
if (this.grid1.paginator) {
76-
this.grid1.paginator.page = page - this._totalPagesOnServer;
77-
}
75+
} else if (this.grid1.paginator) {
76+
const newPage = page - this._totalPagesOnServer > -1 ? page - this._totalPagesOnServer : 0;
77+
this.grid1.paginator.page = newPage;
7878
}
79-
this.page = page;
80-
const skip = this.page * this.perPage;
79+
const skip = page * this.perPage;
8180
this.remoteService.getData(skip, skip + this.perPage);
81+
this.page = page;
8282
}
8383

8484
public addRow() {

0 commit comments

Comments
 (0)