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

feat(backend): add cancellable Pagination change & revert on error #466

Merged
merged 1 commit into from
Sep 4, 2021

Conversation

ghiscoding
Copy link
Owner

@ghiscoding ghiscoding commented Sep 4, 2021

  • this enhancement idea came from this Discussion
  • in previous code, if an error happens on the backend server while querying, the Pagination would still be changed and we had no clue of the previous page number (or page size change), this PR bring this functionality that if an error occurs it will rollback to previous Pagination
  • when using a Backend Service, you can prevent the Pagination via onBeforePaginationChange while on a local (in-memory) it would be via the DataView onBeforePagingInfoChanged event
  • for a demo, you can look at previous PR feat(backend): add cancellable onBeforeSort & revert sort on error #463

cancellable event code sample

// for a local (in-memory) grid, you need to use the DataView event
gridContainerElm.addEventListener('onBeforePagingInfoChanged', (e) => {
  e.preventDefault();
  return false;
});

// for a Backend Service API, you can use 
gridContainerElm.addEventListener('onBeforePaginationChange', (e) => {
  e.preventDefault();
  return false;
});

- in previous code, if an error happens on the backend server while querying, the Pagination would still be changed and we had no clue of the previous page number (or page size change), this PR bring this functionality that if an error occurs it will rollback to previous Pagination
- when using a Backend Service, you can prevent the Pagination via `onBeforePaginationChange` while on a local (in-memory) it would be via the DataView `onBeforePagingInfoChanged` event
@codecov
Copy link

codecov bot commented Sep 4, 2021

Codecov Report

Merging #466 (7a8d903) into master (913ef72) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #466   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          220       220           
  Lines        13537     13562   +25     
  Branches      4436      4452   +16     
=========================================
+ Hits         13537     13562   +25     
Impacted Files Coverage Δ
...ages/common/src/services/backendUtility.service.ts 100.00% <100.00%> (ø)
packages/common/src/services/pagination.service.ts 100.00% <100.00%> (ø)
...nation-component/src/slick-pagination.component.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 913ef72...7a8d903. Read the comment docs.

@ghiscoding ghiscoding merged commit b4215ac into master Sep 4, 2021
@ghiscoding ghiscoding deleted the feat/backend-cancellable-pagination branch September 4, 2021 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant