# TreeView + Updating list on mouse-click of header

**URL:** <https://www.ruby-forum.com/t/treeview-updating-list-on-mouse-click-of-header/81242>\
**Category:** Ruby-Gnome 2\
**Created:** [January 6, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/treeview-updating-list-on-mouse-click-of-header/81242 "2007-01-06T19:30:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [January 6, 2007, 7:30pm UTC](https://www.ruby-forum.com/t/treeview-updating-list-on-mouse-click-of-header/81242/1 "2007-01-06T19:30:34Z")

</div>

Hi there,

I am using TreeView to display list store data

This works fine.

However, I want that, if you click on the header,  
the list store to update and sort alphabetically.

My problem is - there seems to be no event possible  
when you click on that header?

Example of my widget:

* * *

Name Age Profession

* * *

joe | 51 | C# Coder  
tim | 31 | Python Coder  
pete | 25 | Ruby C.  
| |  
| |  
| |

And I want to update the listings whenever  
someone clicks on “Age” or “Profession”  
in that header, inserted via

tree\_view.insert\_column(-1, ‘Age’, renderer, :text =\> 1)  
tree\_view.insert\_column(-1, ‘Profession’, renderer, :text =\> 2)

–

* * *

Search for products and services at:

> **[mail.com Search](https://search.mail.com/web)**
>
> mail.com Search – quick, clear, accurate

Powered by Outblaze

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [January 19, 2007, 4:30pm UTC](https://www.ruby-forum.com/t/treeview-updating-list-on-mouse-click-of-header/81242/2 "2007-01-19T16:30:14Z")

</div>

Hi,

In [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
“[ruby-gnome2-devel-en] TreeView + Updating list on mouse-click of  
header” on Fri, 05 Jan 2007 02:02:03 +0100,  
“Roebe XXX” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> My problem is - there seems to be no event possible  
> when you click on that header?
> 
> And I want to update the listings whenever  
> someone clicks on “Age” or “Profession”  
> in that header, inserted via
> 
> tree\_view.insert\_column(-1, ‘Age’, renderer, :text =\> 1)  
> tree\_view.insert\_column(-1, ‘Profession’, renderer, :text =\> 2)

You can’t. Use the following way instead of your way:

column = Gtk::TreeViewColumn.new('Age, renderer, :text =\> 1)  
column.set\_sort\_column\_id(1)  
tree\_view.append\_column(column)

This sample source will help you:  
[CVS Info for project ruby-gnome2](http://ruby-gnome2.cvs.sourceforge.net/ruby-gnome2/ruby-gnome2/gtk/sample/gtk-demo/list_store.rb?revision=HEAD&view=markup)

## Thanks,

kou

* * *

Take Surveys. Earn Cash. Influence the Future of IT  
Join [SourceForge.net](http://SourceForge.net)’s Techsay panel and you’ll get the chance to share  
your  
opinions on IT & business topics through brief surveys - and earn cash  
[http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV](http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV)
