Skip to main content



      Home
Home » Eclipse Projects » Nebula » GridTableViewer and sorting
GridTableViewer and sorting [message #593797] Tue, 24 February 2009 05:32 Go to next message
Eclipse UserFriend
Hi all

How do I sort a Grid when using a GridTableViewer? I tried it using a
ColumnViewerSorter, but that doesn't seem to work. Furthermore, Grid
doesn't seem to have API like setSortColumn() or setSortDirection().

Any help is highly appreciated.
Thanks,
Christian
Re: GridTableViewer and sorting [message #872778 is a reply to message #593797] Wed, 16 May 2012 15:56 Go to previous messageGo to next message
Eclipse UserFriend
hi
is there any example of GridTableViewer sorting (Not TableViewer sorting)
no use of columns indexes nor an ITableLabelProider
GridTableViewer use independent columns with for each an labelprovider.
i search but no example was found.

thanks all
Re: GridTableViewer and sorting [message #873059 is a reply to message #872778] Thu, 17 May 2012 08:35 Go to previous message
Eclipse UserFriend
I am using sorting on my GridTreeViewer - I assume it would be the same/similar on the GridTableViewer. Here's what I did:
1. Created my own Comparator class that extends ViewerComparator
2. On the GridTreeViewer (gtv) I called: gtv.setComparator(myViewerComparator)
3. On each GridColumn (gc) I added a selectionListener that would get the comparator and set any information that I wanted it to know (the sort direction, the columnNumber (I had different sorting I needed to do based on the column being sorted), set the sort direction marker on the column (gc.setSort(SORTDIRECTION);
4. refresh the gridTreeViewer (gtv.refresh()).

and then the comparator would be called and I did my sort

Sorry I don't have an example code set up for you....but I hope that this helps.

Sharon
Previous Topic: PercentComplete invisible?
Next Topic:Nebula XViewer loads slowly when there are a lot of rows
Goto Forum:
  


Current Time: Thu Jul 10 06:05:41 EDT 2025

Powered by FUDForum. Page generated in 0.37775 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top