Skip to content

Commit

Permalink
fix(pagination): passing custom pagination sizes should work, fixes #456
Browse files Browse the repository at this point in the history
 (#459)

* fix(pagination): passing custom pagination sizes should work, fixes #456
  • Loading branch information
ghiscoding-SE committed May 15, 2020
1 parent c00b6ab commit 0367625
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/app/examples/grid-basic.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class GridBasicComponent implements OnInit {
...{
enablePagination: true,
pagination: {
pageSizes: [5, 10, 15, 20, 25, 50, 75, 100],
pageSizes: [5, 10, 20, 25, 50],
pageSize: 5
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -925,10 +925,8 @@ export class AngularSlickgridComponent implements AfterViewInit, OnDestroy, OnIn
// using jQuery extend to do a deep clone has an unwanted side on objects and pageSizes but ES6 spread has other worst side effects
// so we will just overwrite the pageSizes when needed, this is the only one causing issues so far.
// jQuery wrote this on their docs:: On a deep extend, Object and Array are extended, but object wrappers on primitive types such as String, Boolean, and Number are not.
if (gridOptions && gridOptions.backendServiceApi) {
if (gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes) && gridOptions.pagination.pageSizes.length > 0) {
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
}
if (gridOptions.enablePagination && gridOptions.pagination && Array.isArray(gridOptions.pagination.pageSizes)) {
options.pagination.pageSizes = gridOptions.pagination.pageSizes;
}

// also make sure to show the header row if user have enabled filtering
Expand Down

0 comments on commit 0367625

Please sign in to comment.