Skip to content

Commit 3ecd9b9

Browse files
committed
fix(graphql): translate pagination texts on initial load
1 parent 41e321f commit 3ecd9b9

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/app/modules/angular-slickgrid/components/slick-pagination.component.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { AfterViewInit, Component, EventEmitter, Injectable, Input, OnDestroy, Optional, Output } from '@angular/core';
1+
import { AfterViewInit, Component, EventEmitter, Input, OnDestroy, Optional, Output } from '@angular/core';
22
import { TranslateService } from '@ngx-translate/core';
33
import { Subscription } from 'rxjs';
44

@@ -47,6 +47,7 @@ export class SlickPaginationComponent implements AfterViewInit, OnDestroy {
4747
/** Constructor */
4848
constructor(private paginationService: PaginationService, @Optional() private translate: TranslateService) {
4949
// translate all the text using ngx-translate or custom locales
50+
this.translateAllUiTexts(this.locales);
5051
if (translate && translate.onLangChange) {
5152
this.subscriptions.push(this.translate.onLangChange.subscribe(() => this.translateAllUiTexts(this.locales)));
5253
}

src/app/modules/angular-slickgrid/services/pagination.service.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ export class PaginationService {
121121
}
122122

123123
goToLastPage(event?: any): Promise<any> {
124-
this._pageNumber = this._pageCount;
124+
this._pageNumber = this._pageCount || 1;
125125
return this.processOnPageChanged(this._pageNumber, event);
126126
}
127127

@@ -253,7 +253,7 @@ export class PaginationService {
253253
this._dataTo = 0;
254254
this._pageNumber = 0;
255255
} else {
256-
this._dataFrom = (this._pageNumber * this._itemsPerPage) - this._itemsPerPage + 1;
256+
this._dataFrom = this._pageNumber > 1 ? ((this._pageNumber * this._itemsPerPage) - this._itemsPerPage + 1) : 1;
257257
this._dataTo = (this._totalItems < this._itemsPerPage) ? this._totalItems : (this._pageNumber * this._itemsPerPage);
258258
if (this._dataTo > this._totalItems) {
259259
this._dataTo = this._totalItems;

0 commit comments

Comments
 (0)