TableViewer: Sorting on multiple columns [message #534627] |
Wed, 19 May 2010 12:43  |
Eclipse User |
|
|
|
Is there an example of how multiple column sorting can be done on the tableviewer? I have found examples of single column sorting, but nothing related to accomplishing a multiple sort. If anyone has successfully done this, could you please share how it was done?
We have a dialog where we select the columns by which to sort. Assuming that we somehow persist / remember this information, and have access to it in the comparator implementation, I am not sure how the multi-column sort would be accomplished inside the "compare()" method.... after all, the comparator compares two objects at a time... how is it possible to sort on multiple columns in such a case? This is where I am looking for some help or a sample.
Thanks.
|
|
|
Re: TableViewer: Sorting on multiple columns [message #535094 is a reply to message #534627] |
Fri, 21 May 2010 05:48  |
Eclipse User |
|
|
|
I was able to implement this similar to the concept of sorting multi-dimensional arrays. So, inside the compare() method, I would look at the multiple values (corresponding to multiple columns) on the first object, and then compare each value with the same values on the other object.
|
|
|
Powered by
FUDForum. Page generated in 0.03714 seconds