-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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: add page start end total to PagerRenderer
#9371
feat: add page start end total to PagerRenderer
#9371
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks useful, thanks!
4147d9f
to
2bcf4ab
Compare
Thanks for your help @michalsn! Just signed my commits and resolved the type hints. Let's see if anyone else has anything to say about the implementation. Meanwhile I'm gonna write the documentation. |
It's been a long time, but this feature has already been requested: |
Just applied all the suggestion made and thanks for the pointing out the forum post @neznaika0! |
Your suggentions make sense @neznaika0, thanks! Regarding the documentation, I've added a simple one, it would be nice to a have a review there too. Here's a screenshot to make thinks easier: |
Add note in changelog 4.6 |
The errors are not related to this PR and they were already fixed in the upstream. Please rebase: https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#updating-your-branch |
get the first item, the last item and the total of items.
… of the variables from the PagerRenderer class.
8898145
to
ce162e2
Compare
Just rebased and added a changelog, thanks for your help @michalsn and @neznaika0! |
PagerRenderer
Thank you, @murilohpucci , for your first contribution to CI4! |
Thank you! |
Description
I've recently started using CodeIgniter. While working with the pagination library, I noticed that it lacks functionality to easily display the range of results currently being shown alongside the total number of results(unless there's an easy way to get all the information and I wasn't able to figure it out, in this case sorry for all the noise here). This feature is particularly useful when building UI components like the one below:
Currently, the PageRenderer.php class (referenced here) gets the total number of results but does not provide a getter to access this information.
This enhancement would be especially beneficial for content editors who rely on result counts to manage their workflows.
Proposed solution
I've created some new variables to hold the information of the items that are showing on the page, and on the construct method if the total items is passed, I call a new function to calculate the items the page started and ended. Then the getters to expose the data.
Disclaimer
This is my first contribution to the project, so I may have missed something or not followed best practices. If so, please let me know.
Regarding documentation updates, I plan to address them in a separate commit once the core functionality is reviewed.
Feel free to review the code! Thanks!