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 initialization issue. #566

Merged
merged 4 commits into from
Feb 27, 2025
Merged

Fix pagination initialization issue. #566

merged 4 commits into from
Feb 27, 2025

Conversation

rabbitism
Copy link
Member

@rabbitism rabbitism commented Feb 8, 2025

This pull request includes several changes to the pagination functionality in the Ursa project, focusing on improving the handling of the current page and ensuring proper initialization. The most important changes are grouped by theme below.

Pagination Initialization and Current Page Handling:

  • Added CurrentPage="5" to the Pagination control in PaginationDemo.axaml to set the default current page in the demo.
  • Modified CoerceCurrentPage method to only coerce the value if the pagination is initialized, preventing default coercion when PageCount is not yet determined.
  • Added a check in OnPageSizeChanged to return early if the pagination is not initialized, ensuring the page count is only updated when appropriate.
  • Updated OnApplyTemplate to set CurrentPage using MathHelpers.SafeClamp and to call UpdateButtonsByCurrentPage with the current page, ensuring buttons are correctly updated based on the current page.
  • Refactored UpdateButtonsByCurrentPage to calculate currentPage and residue earlier in the method for better readability and maintainability.

@rabbitism rabbitism marked this pull request as draft February 8, 2025 17:14
@rabbitism rabbitism linked an issue Feb 20, 2025 that may be closed by this pull request
@rabbitism rabbitism marked this pull request as ready for review February 20, 2025 17:46
@rabbitism
Copy link
Member Author

@cxwl3sxl please help to review.

@rabbitism rabbitism changed the title WIP: fix pagination initialization issue. Fix pagination initialization issue. Feb 27, 2025
@rabbitism
Copy link
Member Author

no feedback from reporter. merge.

@rabbitism rabbitism merged commit 55031c5 into main Feb 27, 2025
2 checks passed
@rabbitism rabbitism deleted the page branch February 27, 2025 08:04
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.

Pagination计算总页数问题
1 participant