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
Copy file name to clipboardExpand all lines: user_guide_src/source/libraries/pagination.rst
+20-5Lines changed: 20 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -227,14 +227,21 @@ setSurroundCount()
227
227
In the first line, the ``setSurroundCount()`` method specifies than we want to show two links to either side of
228
228
the current page link. The only parameter that it accepts is the number of links to show.
229
229
230
+
.. note:: You must call this method first to generate correct pagination links.
231
+
230
232
hasPrevious() & hasNext()
231
233
-------------------------
232
234
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.
238
245
239
246
getPrevious() & getNext()
240
247
-------------------------
@@ -278,6 +285,14 @@ This method returns a boolean ``true`` if there are links to a page before and a
278
285
279
286
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()``.
280
287
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.
0 commit comments