sort by X and then by Y #5371

Closed
opened 2025-12-29 19:27:14 +01:00 by adam · 5 comments
Owner

Originally created by @opericgithub on GitHub (Sep 16, 2021).

NetBox version

v3.0.3

Feature type

New functionality

Proposed functionality

Regarding newly implemented functionality of sorting tenants alphabetically (#6988), one should have a choice of sorting by one column, then by another column etc. For example, this could be done by clicking the header of the column "tenant group" and then clicking the header of the column "tenant". Optionally there might be displayed numbers 1,2 etc. next to the clicked column header, in the order of clicking/sorting.

Use case

If there is a need to use the old method of sorting (ie. prior to v3.0.3 tenants in circuits list are sorted by tenant group, not alphabetically), one should sort the list first by tenant group, then by tenant.

Database changes

not sure

External dependencies

not sure

Originally created by @opericgithub on GitHub (Sep 16, 2021). ### NetBox version v3.0.3 ### Feature type New functionality ### Proposed functionality Regarding newly implemented functionality of sorting tenants alphabetically (#6988), one should have a choice of sorting by one column, then by another column etc. For example, this could be done by clicking the header of the column "tenant group" and then clicking the header of the column "tenant". Optionally there might be displayed numbers 1,2 etc. next to the clicked column header, in the order of clicking/sorting. ### Use case If there is a need to use the old method of sorting (ie. prior to v3.0.3 tenants in circuits list are sorted by tenant group, not alphabetically), one should sort the list first by tenant group, then by tenant. ### Database changes not sure ### External dependencies not sure
adam added the type: featurestatus: needs ownerpending closure labels 2025-12-29 19:27:15 +01:00
adam closed this issue 2025-12-29 19:27:15 +01:00
Author
Owner

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

django-tables2, which NetBox employs for generating tables in the UI, does support ordering by multiple attributes on the backend. However, implementing this in an elegant way on the frontend could be tricky.

For example, if I have sites ordered by tenant, and then click the "name" header, NetBox doesn't know if I intent to apply that as the new primary ordering, or enable it as a secondary ordering after tenant. It would be very tedious to require the user to deselect that active ordering column(s) before choosing a new one. How do you propose implementing this?

@jeremystretch commented on GitHub (Sep 16, 2021): django-tables2, which NetBox employs for generating tables in the UI, does [support ordering by multiple attributes](https://github.com/jieter/django-tables2/issues/559) on the backend. However, implementing this in an elegant way on the frontend could be tricky. For example, if I have sites ordered by tenant, and then click the "name" header, NetBox doesn't know if I intent to apply that as the new primary ordering, or enable it as a secondary ordering after tenant. It would be very tedious to require the user to deselect that active ordering column(s) before choosing a new one. How do you propose implementing this?
Author
Owner

@opericgithub commented on GitHub (Sep 17, 2021):

I understand your concerns and it might be really tricky to implement.

As described here: https://www.codeproject.com/Articles/5166021/Multiple-Column-Sorting-from-Angular-NgExTable-to maybe one of the proposed solutions would be to do single sorting on classic mouse click, and to begin multicolumn sorting on ctrl+click.

As stated there "With this approach, regularly clicking any sortable column always proceeds with the single column sorting type. When clicking the second sortable column while pressing the Ctrl or Shift key, the process will go to the multiple column sorting workflow. You can remove the sorted columns by clicking the "x" button from the sequence dropdowns until only one sorted column is left on the data grid, which then becomes the single column sorting type. To quickly switch to the single column sorting type, a button, Go to Single Column Sorting, is added onto the multi-sorting command panel."

Of course, I'm not sure if it is feasible at all for you to implement this kind of behaviour.

@opericgithub commented on GitHub (Sep 17, 2021): I understand your concerns and it might be really tricky to implement. As described here: https://www.codeproject.com/Articles/5166021/Multiple-Column-Sorting-from-Angular-NgExTable-to maybe one of the proposed solutions would be to do single sorting on classic mouse click, and to begin multicolumn sorting on ctrl+click. As stated there "With this approach, regularly clicking any sortable column always proceeds with the single column sorting type. When clicking the second sortable column while pressing the Ctrl or Shift key, the process will go to the multiple column sorting workflow. You can remove the sorted columns by clicking the "x" button from the sequence dropdowns until only one sorted column is left on the data grid, which then becomes the single column sorting type. To quickly switch to the single column sorting type, a button, Go to Single Column Sorting, is added onto the multi-sorting command panel." Of course, I'm not sure if it is feasible at all for you to implement this kind of behaviour.
Author
Owner

@BarbarossaTM commented on GitHub (Oct 17, 2021):

Being able to sort tables by multiple columns would be really neat! I also like the proposed idea of ctrl+click.

@BarbarossaTM commented on GitHub (Oct 17, 2021): Being able to sort tables by multiple columns would be **really** neat! I also like the proposed idea of ctrl+click.
Author
Owner

@github-actions[bot] commented on GitHub (Feb 12, 2022):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.

@github-actions[bot] commented on GitHub (Feb 12, 2022): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our [contributing guide](https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md).
Author
Owner

@github-actions[bot] commented on GitHub (Mar 15, 2022):

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions[bot] commented on GitHub (Mar 15, 2022): This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5371