java - Scroll NatTable programmatically -


first question on stackoverflow ;-)

similar question here, trying scroll nat-table programmatically. can neither show selected item, nor set value scrollbar (via gethorizontalbar or similar).

the internet wields no answers, far see, , solutions suggested other swt controls not seem apply...

that depends on trying achieve. want select cell , move viewport, or want move cells viewport without selection?

for moving cells viewport should try corresponding commands achieve this:

  • showrowinviewportcommand
  • showcolumninviewportcommand
  • showcellinviewportcommand

    nattable.docommand(new showrowinviewportcommand(gridlayer.getbodylayer(), 50));

to achieve selection , moving row viewport, use corresponding selection commands:

  • selectrowscommand
  • selectcolumncommand
  • selectcellcommand

    nattable.docommand(new selectrowscommand(gridlayer.getbodylayer(), 0, 50, false, false));

note need consider position/index transformations, means above statement select 51 row in grid because of column header.


Comments