2

I have created a SWT table with 23 columns in the Eclipse RCP. The table has only Horizontal Scroll Bar. In runtime, it is obvious that the columns to the left get obstructed when we scroll to Rightward and vice-versa because our view (window) can not display all columns at once. But, I want one of the columns(say col. 2) at Left of the Table to be movable, so that it should be floating at very Left of the table when I scroll the table data Rightward at runtime.

I've tried by setting the col. property movable like :

 tblData.getColumn(1).setMoveable(true);

But, it can only make the col.2 be moved (by dragging withing table header). But I wish the column be floating on the table while scrolling (to rightwards/Leftwards) other data in table. Please, suggest me how to do this.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
yayayokoho3
  • 1,209
  • 2
  • 16
  • 40

1 Answers1

4

There is no really cool way of achieving what you want using Table. But there is an official Snippet showing how to emulate something similar here.

If you don't mind using an SWT table implementation which is not natively drawn, apparently NatTable supports "Frozen columns".

Also one of Nebula's custom table implementations might be capable to do what you want. There's Grid and XViewer.

the.duckman
  • 6,376
  • 3
  • 23
  • 21
  • Thank you the.duckman very very much. Your answer helped me dramatically. It's the greatest answer i've ever accepted in stackoverflow. I'm very happy.Thank you once again. – yayayokoho3 Jul 06 '11 at 11:13
  • this comment is esp. for the.duckman, Your tips worked well for me. But I've few major problems to use this NatTable grid. 1. The no. of cols. and no. of rows returned by natTable.getColumnCount() and natTable.getRowCount are irrational to actual numbers of cols. and rows. Do you have further tips to treat this situation, or any clues to use this Grid with all its features as well as basic features as we do with Nebula Grid or SWT table ? – yayayokoho3 Jul 15 '11 at 10:47
  • Nope, sorry, I got not enough experience with NatTable to help you here. But you might want to try their forum: [official NatTable forum for developers](http://sourceforge.net/projects/nattable/forums/forum/744994) – the.duckman Jul 15 '11 at 18:18
  • Thank you the.duckman for this information. I'll check out the forum. – yayayokoho3 Jul 17 '11 at 05:16