Forum: wxRuby Sorting Grid by column

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Glen H. (Guest)
on 2008-10-27 23:20
(Received via mailing list)
What would be the best way to sort a grid by the column the user clicks
on?
I have a bunch of database info being represented in grids (via
GridTableBase) that I would like to be sortable by different columns.  I
didn't see anything in the Grid or GridTableBase about a column select
event.

Thanks,
Glen

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
Alex F. (Guest)
on 2008-10-30 05:33
(Received via mailing list)
Glen H. wrote:
> What would be the best way to sort a grid by the column the user
> clicks on?  I have a bunch of database info being represented in grids
> (via GridTableBase) that I would like to be sortable by different
> columns.  I didn't see anything in the Grid or GridTableBase about a
> column select event.
There is an event evt_grid_label_left_click which is fired when a row or
column header is clicked on. You can call get_col on the event object to
find out which column was clicked. There are also similar events for
right clicks and double clicks.

To re-order a column, I think it should be enough to change what
GridTableBase is returning in your case, and then calling refresh on the
Grid.

To select a whole column just use Grid#select_col method.

cheers
alex
Glen H. (Guest)
on 2008-11-03 21:46
(Received via mailing list)
On Mon, Oct 27, 2008 at 5:10 PM, Alex F. <removed_email_address@domain.invalid> 
wrote:

> find out which column was clicked. There are also similar events for right
> _______________________________________________
> wxruby-users mailing list
> removed_email_address@domain.invalid
> http://rubyforge.org/mailman/listinfo/wxruby-users
>

Thanks Alex!

It works beautifully.

-Glen

--
"Hey brother Christian with your high and mighty errand, Your actions
speak
so loud, I can't hear a word you're saying."

-Greg Graffin (Bad Religion)
This topic is locked and can not be replied to.