fixed pagination bug and added option of 25 results to the UI #5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description:
The changes in this pull request aim to address pagination display issues where only 10 pages were consistently shown. Additionally, the default number of items per page has been updated to match the items displayed in the UI. Furthermore, the "Results per page" menu has been enhanced to include the option for displaying 25 items per page alongside the existing options. These adjustments aim to fix the pagination issue where not all pages were being displayed properly.
Before:
After:
Changes Made:
Updated Default Items Per Page:
Improved Pagination Calculation:
numPages()
method to calculate the total number of pages based on the current count of results and the selected number of items per page. This ensures accurate pagination irrespective of the chosen number of items per page.Adjusted Total Visible Pages:
totalVisible()
to dynamically set the total visible pages based on the screen size, ensuring consistent and optimal display of pagination controls.Enhanced Results Per Page Menu:
Additional Notes:
These changes have been tested locally and verified to work as expected.
Note that if you attempt to display a page with records beyond the maximum size of 10,000, an error will be received from the API. Maximum results size of 10,000 records is exceeded. Cursor pagination is required for records beyond 10,000. See: https://docs.openalex.org/api#cursor-paging