[Gtk-sharp-list] a treeview sorting question

Miguel de Icaza miguel@ximian.com
22 Sep 2003 03:13:07 -0400


Hello,

> I have a treeview, and when the user clicks one of the headers, i want the 
> treeview to sort all the rows based on the columnheader that was clicked 
> (this was easy to get working), but after it finishes sorting i would like it 
> to return to a state where it doesn't automatically put the newly added rows 
> in a sorted order, but rather at the end of the treeview.  Basically, i want 
> the treeview to sort all the rows when one of the headers is clicked, but i 
> want to just sort all those rows once.  If rows are added after that 
> operation, they are added in an unsorted order until the user once again 
> presses on one of the columnheaders.  Could anyone tell me how i can do this 
> with gtk#?

You can change your model to include a column with the location.  You
sort your data and assign incremental values to it.  Then when you add
a new value at the end, assign a new incremental number.

Miguel.