Implement treestore sorting #243

Open
wants to merge 3 commits into
from

Projects

None yet

2 participants

@riviti

This makes it possible to tell TreeStore to sort the rows by one of the columns. Implemented for GTK and WPF. Mac is impossible for me to do since I do not have a system to test on.

@sevoku
Mono Project member

Any progress here? I'm going to look on sorting next weeks. Has someone tried this approach? Can the backend code be reused?

@sevoku sevoku commented on the diff Jan 18, 2015
Xwt/Xwt/TreeStore.cs
@@ -69,6 +69,11 @@ public TreeStore (params IDataField[] fields)
ITreeStoreBackend Backend {
get { return (ITreeStoreBackend)BackendHost.Backend; }
}
+
+ public void SetSortField (IDataField field, ColumnSortDirection order)
@sevoku
sevoku Jan 18, 2015

This is redundant. Sorting can be set on the columns directly.

@riviti
riviti Feb 3, 2015

As far as I remember, for the Gtk+ backend this is (was) not possible, because the Xwt column does not have access to the Gtk+ tree store, which is where sorting is controlled in that toolkit. I remember there was some Xwt api concern about this PR which is the reason for it not being merged, but the discussion doesn't seem to have happened here, perhaps it was in #mono or #monodevelop.

@sevoku
sevoku Feb 3, 2015

Hhm, I recently merged 8d05788 (PR: #429) which adds column sorting for Gtk (https://github.com/mono/xwt/blob/master/Xwt.Gtk/Xwt.GtkBackend/TableViewBackend.cs#L149) and it seems to work as expected. Column wise sorting has only the limitation that more complex sorting is not possible (e.g. column1=x && column2=y), but this should be implemented in a separate SortFunc implementation which would override column sorting settings (like it does Gtk in the Filter and Sort stores) and is not part of this PR, too.

So the Frontend implementation is Ok, atm. The backends should simply handle the appropriate column settings.

@riviti
riviti Feb 6, 2015

Well, I don't have any immediate interest in getting this merged (anymore), so since it seems to have bitrotted, I'd say whoever feels the need should feel free to pick this work up and finish it.

@sevoku sevoku added the feedback label Jan 25, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment