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

fixed pagination bug and added option of 25 results to the UI #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

suzuya1331
Copy link

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:

image

After:

image

Changes Made:

Updated Default Items Per Page:

  • Changed the default number of items per page from 10 to 25 to better match the default display in the UI.

Improved Pagination Calculation:

  • Refactored the 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:

  • Implemented a new function 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:

  • Updated "the results per page menu" to reflect the change in default value and added visual indication (checkmark) for the selected option. the menu now includes the option for 25 items per page alongside the existing options for 10 and 100.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants