Skip to content

Unable to scroll to the latest row #6571

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jingzhaoou opened this issue Feb 9, 2018 · 1 comment · Fixed by #6644
Closed

Unable to scroll to the latest row #6571

jingzhaoou opened this issue Feb 9, 2018 · 1 comment · Fixed by #6644
Assignees

Comments

@jingzhaoou
Copy link

No luck even with the cellNav example. If data contains 300 entries and I do

var rowIndex = $scope.gridOptions.data.length - 1;
gridApi.core.scrollTo($scope.gridOptions.data[rowIndex], $scope.gridOptions.columnDefs[0]);

No scrolling happened at all. I tracked down the issue to

          percentage = scrollPixels / scrollLength;
          if (percentage <= 1) {
            scrollEvent.y = { percentage: percentage  };

and found that percentage is a little bit more than 1 in this case. I modified the code to look like

          percentage = scrollPixels / scrollLength;
          if (percentage > 1) { percentage = 1; } // <==== added this line
          if (percentage <= 1) {
            scrollEvent.y = { percentage: percentage  };

After that, I can successfully scroll to the last data entry.

@wduminy
Copy link

wduminy commented Feb 16, 2018

I also found an issue (seems to be the same). To reproduce:

  • Fill the grid with more rows that can fit into the view.
  • call scrollTo() to go to last row

It seems to scroll to the top of the last row; but the last row is not in the view.

Additional info

It could be related to the horizontal scroll bar.

One solution might be to scroll to the bottom when the last row is the target of scrollTo().

mportuga pushed a commit that referenced this issue Mar 28, 2018
Updated the scrollToIfNecessary to treat any percentage number for the scroll position that is
greater than 1 as 1.

fix #6571
@mportuga mportuga self-assigned this Mar 28, 2018
mportuga pushed a commit that referenced this issue Mar 28, 2018
Updated the scrollToIfNecessary to treat any percentage number for the scroll position that is
greater than 1 as 1.

fix #6571, fix #6507, fix #6563
mportuga pushed a commit that referenced this issue Mar 28, 2018
Updated the scrollToIfNecessary to treat any percentage number for the scroll position that is
greater than 1 as 1.

fix #6571, fix #6507, fix #6563
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants