Enable pagination orphans #4928

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

Originally created by @jeremystretch on GitHub (May 18, 2021).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v2.11.3

Feature type

Change to existing functionality

Proposed functionality

The paginator currently does not support the inclusion of "orphan" objects. For example, when viewing a set of 103 objects with a page size of 50, NetBox will display three pages:

  • 1-50
  • 51-100
  • 101-103

Enabling the inclusion of (at least 3) oprhans would result in two pages:

  • 1-50
  • 51-103

With a page size of 100, it would result in a single page showing all objects.

It probably makes sense to calculate the number of orphans permitted based on the page size: perhaps 5 for page sizes up to 50, and 10 for page sizes greater than 50.

This change would have no effect on REST API pagination.

Use case

As the performance impact of retrieving 53 versus 50 objects is negligible, automatically including the stray objects on the last page saves the user a bit of clicking. This can be especially useful when viewing device components: Many network devices, for example, have 52 interfaces (48 primary + 4 "uplinks"). This would avoid the need to paginate the interfaces list.

Database changes

No response

External dependencies

No response

Originally created by @jeremystretch on GitHub (May 18, 2021). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v2.11.3 ### Feature type Change to existing functionality ### Proposed functionality The paginator currently does not support the inclusion of ["orphan" objects](https://docs.djangoproject.com/en/3.2/ref/paginator/#django.core.paginator.Paginator.orphans). For example, when viewing a set of 103 objects with a page size of 50, NetBox will display three pages: * 1-50 * 51-100 * 101-103 Enabling the inclusion of (at least 3) oprhans would result in two pages: * 1-50 * 51-103 With a page size of 100, it would result in a single page showing all objects. It probably makes sense to calculate the number of orphans permitted based on the page size: perhaps 5 for page sizes up to 50, and 10 for page sizes greater than 50. This change would have no effect on REST API pagination. ### Use case As the performance impact of retrieving 53 versus 50 objects is negligible, automatically including the stray objects on the last page saves the user a bit of clicking. This can be especially useful when viewing device components: Many network devices, for example, have 52 interfaces (48 primary + 4 "uplinks"). This would avoid the need to paginate the interfaces list. ### Database changes _No response_ ### External dependencies _No response_
adam added the status: acceptedtype: feature labels 2025-12-29 19:22:21 +01:00
adam closed this issue 2025-12-29 19:22: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#4928