Skip to content

Commit

Permalink
fix(resizer): grid size fix for backend service with pagination disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding-SE committed Jan 15, 2020
1 parent beda628 commit 6c4bcca
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/app/examples/grid-graphql.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export class GridGraphqlComponent implements OnInit, OnDestroy {
}
}
},
enablePagination: true, // you could optionally disable the Pagination
pagination: {
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
pageSize: defaultPageSize,
Expand Down
1 change: 1 addition & 0 deletions src/app/examples/grid-odata.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export class GridOdataComponent implements OnInit {
enableFiltering: true,
enableCheckboxSelector: true,
enableRowSelection: true,
enablePagination: true, // you could optionally disable the Pagination
pagination: {
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
pageSize: defaultPageSize,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,10 +321,6 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
}

if (this.gridOptions && this.gridOptions.backendServiceApi && this.gridOptions.pagination) {
// 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
this.showPagination = ((this.gridOptions.backendServiceApi && this.gridOptions.enablePagination === undefined) ? true : this.gridOptions.enablePagination) || false;

if (this.gridOptions.presets && this.gridOptions.presets.pagination && this.gridOptions.pagination) {
this.paginationOptions.pageSize = this.gridOptions.presets.pagination.pageSize;
this.paginationOptions.pageNumber = this.gridOptions.presets.pagination.pageNumber;
Expand Down Expand Up @@ -753,6 +749,12 @@ 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;

// 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
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export class ResizerService {
// calculate bottom padding
// if using pagination, we need to add the pagination height to this bottom padding
let bottomPadding = (autoResizeOptions && autoResizeOptions.bottomPadding) ? autoResizeOptions.bottomPadding : DATAGRID_BOTTOM_PADDING;
if (bottomPadding && (gridOptions.enablePagination || this._gridOptions.backendServiceApi)) {
if (bottomPadding && gridOptions.enablePagination) {
bottomPadding += DATAGRID_PAGINATION_HEIGHT;
}

Expand Down

0 comments on commit 6c4bcca

Please sign in to comment.