I would like to create a function that would manually position the horizontal scroll bar to the furthest right. I am having a hard time figuring out how to achieve this effect. There was a previous stackoverflow question (How do I scroll an ngGrid to show the current selection?) similar to mine, but the solution was for NgGrid, an older version of ui-grid. A user posted the solution on getting the ngGrid version to work (http://plnkr.co/edit/oyIlX9?p=preview).
$scope.scrollTo = function() {
var grid = $scope.gridOptions.ngGrid;
grid.$viewport.scrollTop(grid.rowMap[$scope.index] * grid.config.rowHeight);
};
I tried to use the same code for ui-grid, but this newer version doesn't seem to have $viewport. I created a plunker to see an example of what I am working on. The horizontal scroll bar initially starts at the furthest left. I would like to write some code to move it to the furthest right.
http://plnkr.co/edit/SJEoPxelB2HYHLsfZ768?p=preview
If anyone can help me, that would be great :)
With the latest ui-grid, you can scroll to the right of the grid using the scrollTo function on the grid.
First argument is the data row and second argument is the column definition with atleast the name of the column.
http://plnkr.co/edit/KfaJti5BTnyvwjWRhtWe?p=preview is the working version.