Skip to content

Commit

Permalink
fix(pagination): should work with page number defined in presets
Browse files Browse the repository at this point in the history
- fix failing Cypress E2E test
  • Loading branch information
ghiscoding-SE committed Jan 15, 2020
1 parent 6ba1fe8 commit 95428ad
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,9 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
this.grid.render();
}

// display the Pagination component only after calling this refresh data first, we call it here so that if we preset pagination page number it will be shown correctly
this.showPagination = ((this.gridOptions && this.gridOptions.enablePagination && (this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined)) ? true : this.gridOptions.enablePagination) || false;

if (this.gridOptions && this.gridOptions.backendServiceApi && this.gridOptions.pagination) {
if (this.gridOptions.presets && this.gridOptions.presets.pagination && this.gridOptions.pagination) {
this.paginationOptions.pageSize = this.gridOptions.presets.pagination.pageSize;
Expand Down Expand Up @@ -749,11 +752,9 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
gridOptions.gridId = this.gridId;
gridOptions.gridContainerId = `slickGridContainer-${this.gridId}`;

// do we want to show pagination?
// if we have a backendServiceApi and the enablePagination is undefined, we'll assume that we do want to see it, else get that defined value
// @deprecated TODO remove this check in the future, user should explicitely enable the Pagination since this feature is now optional (you can now call OData/GraphQL without Pagination which is a new feature)
this.showPagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;
gridOptions.enablePagination = this.showPagination;
gridOptions.enablePagination = ((gridOptions.backendServiceApi && gridOptions.enablePagination === undefined) ? true : gridOptions.enablePagination) || false;

// use jquery extend to deep merge & copy to avoid immutable properties being changed in GlobalGridOptions after a route change
const options = $.extend(true, {}, GlobalGridOptions, this.forRootConfig, gridOptions);
Expand Down

0 comments on commit 95428ad

Please sign in to comment.