The convention of a sort-able grid seems to be well established. A user sorts on a column by clicking on the header and an arrow appears indicating the direction of the sort. However when the column that is sorted contains many duplicates within the grid the sorting is not well defined for the items in the same category.

Somehow I seem to remember that the previous sorting state should be kept for items that are grouped in the same sort key category. However the behavior I observed may have been due to the implementation of the grids I've played with, because however I haven't been able to find any source on the internet to establish my hypothesis.

The Windows File Explorer for instance seems to always sort secondarily on the filename in the same sort direction. When you sort ascending on file type it sorts within the same type ascending on file name. When you sort descending on file type it sorts within the same type descending on file name.

Is there a convention for secondary sorting I'm unaware of or should we implement whatever is most convenient for a specific grid? Also does it really matter?

  • It's not really clear exactly what you\re asking here... – RobbyReindeer Jun 11 at 12:42
  • @RobE thanks, I've added the actual questions I have. – Wouter Jun 11 at 12:46
  • I was a a little confused by the term "grid" at first. I think "table" oder "matrix" would be more precise. How ever "grid" is not wrong. But at first I got a more visual grid in mind like pinterest etc. Those are mostly unsorted. – JonnyZoo Jun 11 at 13:26
  • I understand your question to be: "When sorting by clicking column header, how should items be sorted that share the same value in this column? By some standard column (Explorer example), Keep as before (your memory), or else?" – virtualnobi Jul 1 at 10:52
  • I'd like to add that complex use cases oftentimes require user-defined sorting according to two or more columns (i.e, sort orders by customer classification [class A on top], then by requested delivery date, then by order value). This cannot easily be achieved by clicking column headers – virtualnobi Jul 1 at 10:55

Your secondary sort field should be the primary field, which usually would be the name or an ID, don't know what you data is, so can't say for sure.

If there's always a lot of duplicates, you should consider implementing a primary and secondary sort order.

1) There are other rules for secondary sorting. Sometimes the secondary is the previous secondary. This is the standard sorting. In Excel you can see the same effect on other data.

2) It does matter. But it strongly depends on the application. In Excel it's important because experts have to deal with it. In the file explorer it's very unlikely that other columns help the user to separate two duplicates. (But it could - like tags, author, last modified etc.)

While I agree with the other answers, I would phrase them differently:

Use a stable sort, so that duplicates in the sorted column retain their previous sorting.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.