How to shift the igx-grid to show the selected row?

14 Views Asked by At

I have a paginated grid showing 25 per page. I have code that takes me to the correct page and selected the correct row. however, if the viewport of the grid can only show 10 of the 25 rows, you then have to scroll to find the selected row. Is there any way to autoscroll to the selected row? Here is my current code:

     grid?.selectRows([item.id]);
        //The Utility Service gets you to the right page, the
       // navigateTo in that service takes you to the right row.
    this.utilityService.scrollToRow(item.id,grid);

The Utility Service uses this:

      grid.navigateTo(row.index);
      let scroll = grid.defaultRowHeight * row.index;
      grid.verticalScroll.scrollPosition = scroll;

It works OK unless the selected row is near the edge of the current page, then you have to scroll to it to see it.

0

There are 0 best solutions below