Skip to content

Commit be2c2f9

Browse files
committed
docs: add explanations
1 parent 3388114 commit be2c2f9

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

user_guide_src/source/libraries/pagination.rst

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,14 +227,21 @@ setSurroundCount()
227227
In the first line, the ``setSurroundCount()`` method specifies than we want to show two links to either side of
228228
the current page link. The only parameter that it accepts is the number of links to show.
229229

230+
.. note:: You must call this method first to generate correct pagination links.
231+
230232
hasPrevious() & hasNext()
231233
-------------------------
232234

233-
These methods return a boolean true if there are more links that can be displayed on either side of the current page,
234-
based on the value passed to ``setSurroundCount()``. For example, let's say we have 20 pages of data. The current
235-
page is page 3. If the surrounding count is 2, then the following links would show up in the list: 1, 2, 3, 4, and 5.
236-
Since the first link displayed is page one, ``hasPrevious()`` would return **false** since there is no page zero. However,
237-
``hasNext()`` would return **true** since there are 15 additional pages of results after page five.
235+
These methods return a boolean ``true`` if there are more links that can be displayed on either side of the current page,
236+
based on the value passed to ``setSurroundCount()``.
237+
238+
For example, let's say we have 20 pages of data. The current
239+
page is page 3. If the surrounding count is 2, then the following links would show up like this::
240+
241+
1 | 2 | 3 | 4 | 5
242+
243+
Since the first link displayed is page one, ``hasPrevious()`` would return ``false`` since there is no page zero. However,
244+
``hasNext()`` would return ``true`` since there are 15 additional pages of results after page five.
238245

239246
getPrevious() & getNext()
240247
-------------------------
@@ -278,6 +285,14 @@ This method returns a boolean ``true`` if there are links to a page before and a
278285

279286
Their difference to ``hasPrevious()`` and ``hasNext()`` is that they are based on the current page while ``hasPrevious()`` and ``hasNext()`` are based on the set of links to be displayed before and after the current page based on the value passed in ``setSurroundCount()``.
280287

288+
For example, let's say we have 20 pages of data. The current
289+
page is page 3. If the surrounding count is 2, then the following links would show up like this::
290+
291+
1 | 2 | 3 | 4 | 5
292+
293+
``hasPreviousPage()`` would return ``true`` since there is page 2. And,
294+
``hasNextPage()`` would return ``true`` since there is page 4.
295+
281296
getPreviousPage() & getNextPage()
282297
---------------------------------
283298

0 commit comments

Comments
 (0)