You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add page start end total to PagerRenderer (#9371)
* Add some methods to the page renderer to make easier to
get the first item, the last item and the total of items.
* Add type hint to the new per page variable on the page renderer.
* Create more tests for the page start and end, and improve the comment of the variables from the PagerRenderer class.
* Add a documentation and also improve some comments.
* Use version added instead of warning on the documentation
* Add changelog.
* Fix CR issues.
* Add null as the default value for perPageStart and End
Copy file name to clipboardExpand all lines: user_guide_src/source/changelogs/v4.6.0.rst
+6
Original file line number
Diff line number
Diff line change
@@ -247,6 +247,12 @@ Negotiator
247
247
Previously, response with language headers ``Accept-language: en-US,en-GB;q=0.9`` returned the first allowed language ``en`` could instead of the exact language ``en-US`` or ``en-GB``.
248
248
Set the value to ``true`` to enable comparison not only by language code ('en' - ISO 639-1) but also by regional code ('en-US' - ISO 639-1 plus ISO 3166-1 alpha).
249
249
250
+
Pagination
251
+
==========
252
+
253
+
- Added a new feature to get the total and the range number of items of the current page.
254
+
See :ref:`Displaying the Number of Items on the Page <displaying-the-number-of-items-on-the-page>` for more details.
Copy file name to clipboardExpand all lines: user_guide_src/source/libraries/pagination.rst
+27
Original file line number
Diff line number
Diff line change
@@ -340,3 +340,30 @@ getPageCount()
340
340
--------------
341
341
342
342
This method returns total number of pages.
343
+
344
+
.. _displaying-the-number-of-items-on-the-page:
345
+
346
+
Displaying the Number of Items on the Page
347
+
==========================================
348
+
349
+
.. versionadded:: 4.6.0
350
+
351
+
When paginating items, it’s often helpful to display the total number of items and the range of items shown on the current page. To simplify this task, new methods have been added. These methods make it easier to manage and display pagination details. Here's an example:
352
+
353
+
.. literalinclude:: pagination/019.php
354
+
355
+
getTotal()
356
+
----------
357
+
Returns the total items of the page.
358
+
359
+
getPerPage()
360
+
------------
361
+
Returns the number of items to be displayed on the page.
0 commit comments