Not able to change items per page #3819

Closed
opened 2025-12-29 18:31:21 +01:00 by adam · 0 comments
Owner

Originally created by @hendrikbl on GitHub (Jun 30, 2020).

Originally assigned to: @jeremystretch on GitHub.

Environment

  • Python version: 3.7.7
  • NetBox version: 2.8.6

Steps to Reproduce

  1. Create more than 25 Prefixes (or other model with paginated list view)
  2. Remove any pagination preferences from profile
  3. At the bottom select 50 elements per page

Expected Behavior

The option to set the items per page should still be present if all the models fit on one page in case a user wants to go back to fewer items per page.
The current page indicator should either be hidden or show only one element without the "next" and "previous" buttons.

Observed Behavior

The whole pagination "container" is hidden if there is only one page to display. The only way to reduce the number of elements per page afterwards is to delete the entry from the saved user preferences.

A Solution

A solution would be to only hide the page indicators by moving the "per page" settings out of the if statement in paginator.html:

...
{% if paginator.num_pages > 1 %}
        <nav>
            <ul class="pagination pull-right">
                ...
            </ul>
        </nav>
{% endif %}
        <form method="get">
            ...
        </form>
...
Originally created by @hendrikbl on GitHub (Jun 30, 2020). Originally assigned to: @jeremystretch on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.7.7 * NetBox version: 2.8.6 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. Create more than 25 Prefixes (or other model with paginated list view) 2. Remove any pagination preferences from profile 3. At the bottom select 50 elements per page <!-- What did you expect to happen? --> ### Expected Behavior The option to set the items per page should still be present if all the models fit on one page in case a user wants to go back to fewer items per page. The current page indicator should either be hidden or show only one element without the "next" and "previous" buttons. <!-- What happened instead? --> ### Observed Behavior The whole pagination "container" is hidden if there is only one page to display. The only way to reduce the number of elements per page afterwards is to delete the entry from the saved user preferences. ### A Solution A solution would be to only hide the page indicators by moving the "per page" settings out of the `if` statement in [paginator.html](https://github.com/netbox-community/netbox/blob/develop/netbox/templates/inc/paginator.html): ```jinja ... {% if paginator.num_pages > 1 %} <nav> <ul class="pagination pull-right"> ... </ul> </nav> {% endif %} <form method="get"> ... </form> ... ```
adam added the status: accepted label 2025-12-29 18:31:21 +01:00
adam closed this issue 2025-12-29 18:31:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#3819