Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pagination): passing custom pagination sizes should work #342

Merged
merged 1 commit into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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