Skip to content

Commit

Permalink
fix(pagination): passing custom pagination sizes should work (#342)
Browse files Browse the repository at this point in the history
  • Loading branch information
ghiscoding committed May 15, 2020
1 parent ffa66fd commit 1ca62a4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/aurelia-slickgrid/custom-elements/aurelia-slickgrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,8 @@ export class AureliaSlickgridCustomElement {
// 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 (options && gridOptions && gridOptions.backendServiceApi) {
if (options.pagination && 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
2 changes: 1 addition & 1 deletion src/examples/slickgrid/example1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class Example1 {
...{
enablePagination: true,
pagination: {
pageSizes: [5, 10, 15, 20, 25, 50, 75, 100],
pageSizes: [5, 10, 20, 25, 50],
pageSize: 5
},
}
Expand Down

0 comments on commit 1ca62a4

Please sign in to comment.