Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » NatTable » Nattable row position after scrolling(How to get the row position after scroling)
Nattable row position after scrolling [message #1780162] Thu, 18 January 2018 09:55 Go to next message
Panisha RN is currently offline Panisha RNFriend
Messages: 43
Registered: May 2013
Member
I have implemented DND support in my Nattable implementation.

Upon drop i try to get the row position using API below.

Point pt = dropTargetevent.display.map(null, getTable(), dropTargetevent.x, dropTargetevent.y);
int position = getTable().getRowPositionByY(pt.y);
return position;

It works fine as long as i am not scrolling.

However after i scroll few rows, this functions does not seems to give correct row position..Looks like it consider only visible rows to the user , all the row which gets hidden after scrolling are gettting ignored.

Eg: if i have 100 rows, after scrolling 5 rows up if i try to get the row position of the 5th row which is first visible row in the table after scrolling , i get 1 instead of 5..

I think, i am missing something.

Can some one help me.

Thanks in advance.
Re: Nattable row position after scrolling [message #1780163 is a reply to message #1780162] Thu, 18 January 2018 09:58 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
Yes you are missing a basic concept in NatTable - index-position-transformation. You expect that the method returns you the INDEX in the collection, but it returns you the POSITION in the table. And since you are using the ViewportLayer, this means the position of the visible rows in the table.

You need to get the row index by position. If you search for this topic I suppose you will find several results.
Re: Nattable row position after scrolling [message #1780390 is a reply to message #1780163] Mon, 22 January 2018 06:21 Go to previous message
Panisha RN is currently offline Panisha RNFriend
Messages: 43
Registered: May 2013
Member
Thanks for the help..I worked fine after index-position-transformation.
Previous Topic:Combo box drop down menu appearing outside of viewport
Next Topic:Issue with automatic cell resize with TextPainter
Goto Forum:
  


Current Time: Thu Apr 18 22:48:01 GMT 2024

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

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

Back to the top