Sort order of list and tree views isn't set initially (Bug 12824)

Bug 0012824 has been filed about the sort order in Descendants gramplet, although it extends to other list (tree) views when sort column and order aren’t explicitly set.

In the bug report @GeorgeWilmes observed that when the Descendant Gramplet is first populated the data is shown in a particular order and at that point neither column (name, birth date) has a sort order indicator which I believe is confusing since the UI for a sortable column should indicate that clearly. Once either column header is selected for sorting, the initial unsorted order is not attainable again which is the complaint.

Based on my reading of the code, this is because the initial sort column and sort order are not set for a new list (tree) view (or perhaps more correctly, model) which seems like a bug. A simple patch is attached to the bug which sorts on the first column in ascending order (arbitrary choice, but seems reasonable). Should the behavior of list (tree) model be changed in this way? Doing so makes the sort column and order explicit and visible in the UI leading to consistent behavior. Two concerns with this:

  1. Some users do/may want current unsorted behavior, although it’s arguable that it’s not standard behavior which can’t be restored without additional UI controls/behavior, and
  2. Since this change would affect any models based on ListModel in Gramps, it’s not a change to make without due consideration. In fact the proposed behavior may have been present in Gramps v2.2.0 and prior based on source history (links in the bug report) but was changed to what it is today.

There’s probably history around this issue so it would be useful to hear from developers with more knowledge on it. Thanks.

1 Like

@codefarmer thanks for your investigation. I just want to emphasize that the initial order is indeed a “particular order” as you say (that is, the order that each child stored within each family). This order is valuable (to me, at least), because many of the families in my tree have children who are in order by age (according to census records or other sources) but do not have known birth dates. The gramplet would be less useful to me if its default sort was anything else. And (as the issue explains), I would just like to be able to get back to this sort, after using the other sorts, without having to restart Gramps. Thanks again.


Giving this some more thought, I no longer think that the initial unsorted order (which I suppose is “database order”) is a bug, i.e. that order is as valid as a sorted order in the initial view.

It’s possible that there’s a way to cycle between ascending, descending and unsorted with some clever programming, but so far I have only come across one issue which touches upon this (GTK Issue 794) and that seems to imply that this going to an unsorted view isn’t supported.

So an alternative might be to add a button labeled “Database order” to the view, and when selected, it would reset/recreate/repopulate the tree view and clear the sort column id and sort type. Not sure how exactly to achieve this, but putting this out there for feedback. Developers with GTK experience – is this feasible?

Alternatively, add an option “Restore original order” to the right-click menu? (Current options are “Edit” and “Copy all”.)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.