• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sorting SWT Tree

 
amit pandit
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Can anybody help me to sort a SWT Tree in ascending order.
Is there any API to sort SWT Tree when it is constructed.

I am going through SetSortColumn(),SetSortDirection(), but
still not able to use it correctly.

thnx in advance,

Amit Pandit
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better to use TreeViewer from JFace. You can use setSorter(). In general, it's better to use the more abstracted JFace and only use the lower level SWT stuff if you can't do something with JFace.

BTW... It's far far more efficient to do your sorting at the model level rather than using the ViewerSorter. If you expect to have only a small amount of data, then ViewerSorter will work fine.

Hope it helps.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!