Integer field "null" value sorting #11134

Open
opened 2025-12-29 21:40:48 +01:00 by adam · 2 comments
Owner

Originally created by @loubladi on GitHub (May 7, 2025).

NetBox version

v4.2.8

Feature type

Change to existing functionality

Proposed functionality

Currently sorting of numeric fields puts "null" value field first. Proposed functionality would put "null" values last.

Use case

We have created Integer Custom Field "PoP ID" where we store value of Site. But since we need to keep track of many sites, only fraction of Sites have this field filled. When we want to sort sites by this field we have to go through many pages of empty values (i could be done by filtering, but for many users sort is more convenient).

Image

Database changes

None

External dependencies

None

Originally created by @loubladi on GitHub (May 7, 2025). ### NetBox version v4.2.8 ### Feature type Change to existing functionality ### Proposed functionality Currently sorting of numeric fields puts "null" value field first. Proposed functionality would put "null" values last. ### Use case We have created Integer Custom Field "PoP ID" where we store value of Site. But since we need to keep track of many sites, only fraction of Sites have this field filled. When we want to sort sites by this field we have to go through many pages of empty values (i could be done by filtering, but for many users sort is more convenient). <img width="88" alt="Image" src="https://github.com/user-attachments/assets/9edae6f5-becf-465f-a1b3-22d91ede28a1" /> ### Database changes None ### External dependencies None
adam added the type: featurecomplexity: mediumnetboxstatus: backlog labels 2025-12-29 21:40:48 +01:00
Author
Owner

@jeremystretch commented on GitHub (May 7, 2025):

What specific change(s) are you proposing? Is this specifically for integer custom fields, or elsewhere?

@jeremystretch commented on GitHub (May 7, 2025): What specific change(s) are you proposing? Is this specifically for integer custom fields, or elsewhere?
Author
Owner

@loubladi commented on GitHub (May 7, 2025):

I propose changing the sorting behavior so that entries with null values appear at the end, while fields with actual values appear first.

My current use case involves a Custom Field with integer values, but I believe this behavior could be beneficial for all numeric sorting in NetBox.

Ideally, this could be implemented as a configuration option in configuration.py, allowing administrators to choose how null values are handled during sorting.

@loubladi commented on GitHub (May 7, 2025): I propose changing the sorting behavior so that entries with _null_ values appear at the end, while fields with actual values appear first. My current use case involves a Custom Field with integer values, but I believe this behavior could be beneficial for all numeric sorting in NetBox. Ideally, this could be implemented as a configuration option in configuration.py, allowing administrators to choose how null values are handled during sorting.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11134