Tags do not correctly order in tables #11613

Closed
opened 2025-12-29 21:47:38 +01:00 by adam · 2 comments
Owner

Originally created by @tjmills-dev on GitHub (Sep 15, 2025).

NetBox Edition

NetBox Community

NetBox Version

v4.4.0 (Docker-3.4.0)

Python Version

3.12

Steps to Reproduce

  1. Create tags with varying weights
Image
  1. Add those tags to given objects
Image
  1. Create a table config sorting by tags (as sorting is not possible through the table UI directly)
Image
  1. Return to the given table (here, prefixes) and observe that, alas! The tags are instead ordered alphabetically, and not by weight
Image
  1. BONUS BUG - if one returns to the table config, and instead orders the tags reverse alphabetically, this does not reverse the order in the table
Image Image

Expected Behavior

I would expect that the tags would be ordered by weight.

The API does actually handle this correctly - with a request of http://localhost:8000/api/ipam/prefixes/?ordering=tags the order goes RFC 1918 -> ULA -> GUA (and if reversed with -tags, correctly orders GUA -> ULA -> RFC 1918)

Observed Behavior

The tags are ordered alphabetically. Additionally, they do not order reverse alphabetically if -tags is supplied in the table config.

Originally created by @tjmills-dev on GitHub (Sep 15, 2025). ### NetBox Edition NetBox Community ### NetBox Version v4.4.0 (Docker-3.4.0) ### Python Version 3.12 ### Steps to Reproduce 1. Create tags with varying weights <img width="1403" height="452" alt="Image" src="https://github.com/user-attachments/assets/ddfdc86f-8b0e-48d0-befb-6d3724fe268c" /> 2. Add those tags to given objects <img width="1210" height="309" alt="Image" src="https://github.com/user-attachments/assets/683d767b-66cd-4f59-ae7c-e4426842cf98" /> 3. Create a table config sorting by tags (as sorting is not possible through the table UI directly) <img width="1005" height="976" alt="Image" src="https://github.com/user-attachments/assets/f1007276-3683-470f-a994-b1b314897887" /> 4. Return to the given table (here, prefixes) and observe that, alas! The tags are instead ordered alphabetically, and not by weight <img width="275" height="938" alt="Image" src="https://github.com/user-attachments/assets/c7b461dd-c75d-4eec-abd2-a76f13964f1b" /> 5. BONUS BUG - if one returns to the table config, and instead orders the tags reverse alphabetically, this does not reverse the order in the table <img width="852" height="554" alt="Image" src="https://github.com/user-attachments/assets/88ea32f8-720b-45c8-bdb4-4a0bfe6bef0d" /> <img width="278" height="940" alt="Image" src="https://github.com/user-attachments/assets/e380dafd-e617-4c78-960d-505d00c54624" /> ### Expected Behavior I would expect that the tags would be ordered by weight. The API does actually handle this correctly - with a request of `http://localhost:8000/api/ipam/prefixes/?ordering=tags` the order goes RFC 1918 -> ULA -> GUA (and if reversed with `-tags`, correctly orders GUA -> ULA -> RFC 1918) ### Observed Behavior The tags are ordered alphabetically. Additionally, they do not order reverse alphabetically if -tags is supplied in the table config.
adam added the netbox label 2025-12-29 21:47:38 +01:00
adam closed this issue 2025-12-29 21:47:38 +01:00
Author
Owner

@tjmills-dev commented on GitHub (Sep 15, 2025):

Have just realised why this is - tags are not orderable. It might be worth documenting that somewhere (and for other non-orderable columns) just so no-one else gets confused like I did.

For now, I've added a custom column with the tag values as options, which it sorts on, and then add the tags also (I like the colours!)

@tjmills-dev commented on GitHub (Sep 15, 2025): Have just realised why this is - tags are not orderable. It might be worth documenting that somewhere (and for other non-orderable columns) just so no-one else gets confused like I did. For now, I've added a custom column with the tag values as options, which it sorts on, and then add the tags also (I like the colours!)
Author
Owner

@jeremystretch commented on GitHub (Sep 16, 2025):

Have just realised why this is - tags are not orderable. It might be worth documenting that somewhere (and for other non-orderable columns) just so no-one else gets confused like I did.

Correct. You'll note that the table cannot be ordered by clicking on the header of the tags column, because ordering by tag assignment is not supported.

@jeremystretch commented on GitHub (Sep 16, 2025): > Have just realised why this is - tags are not orderable. It might be worth documenting that somewhere (and for other non-orderable columns) just so no-one else gets confused like I did. Correct. You'll note that the table cannot be ordered by clicking on the header of the tags column, because ordering by tag assignment is not supported.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11613