Sort table by object custom field #11340

Closed
opened 2025-12-29 21:43:51 +01:00 by adam · 1 comment
Owner

Originally created by @llamafilm on GitHub (Jul 3, 2025).

NetBox version

v4.3.2

Feature type

New functionality

Proposed functionality

When looking at the /dcim/devices table webpage, you can sort by string type custom fields. I would like to also sort by object type custom fields.

Use case

I have a custom field called location_served on each Device which references a Location object. I have a custom validator that sets this field to the device's location by default, unless the user overrides it. This is useful in Grafana dashboards in case a device serves a room other than its physical location, i.e. a central machine room. I'd like to be able to sort the device list by this field.

Database changes

No response

External dependencies

No response

Originally created by @llamafilm on GitHub (Jul 3, 2025). ### NetBox version v4.3.2 ### Feature type New functionality ### Proposed functionality When looking at the `/dcim/devices` table webpage, you can sort by _string_ type custom fields. I would like to also sort by _object_ type custom fields. ### Use case I have a custom field called `location_served` on each Device which references a Location object. I have a custom validator that sets this field to the device's location by default, unless the user overrides it. This is useful in Grafana dashboards in case a device serves a room other than its physical location, i.e. a central machine room. I'd like to be able to sort the device list by this field. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: feature label 2025-12-29 21:43:51 +01:00
adam closed this issue 2025-12-29 21:43:52 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jul 3, 2025):

This is a technical limitation stemming from the way custom fields are implemented: It's not feasible to order by related objects in this manner as custom field relations are not real foreign key associations.

Happy to re-open this if anyone wants to propose a workable technical implementation, but closing this for now as untenable.

@jeremystretch commented on GitHub (Jul 3, 2025): This is a technical limitation stemming from the way custom fields are implemented: It's not feasible to order by related objects in this manner as custom field relations are not real foreign key associations. Happy to re-open this if anyone wants to propose a workable technical implementation, but closing this for now as untenable.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11340