2

Scroll to focus is not working on a newly added row when the new item is added to the bottom of the table.

https://github.com/angular-ui/ui-grid/issues/5325 discusses this issue.

The plnkr link http://plnkr.co/edit/OSbiB5C0RDPsqXJV0yjy?p=preview given there as solution is working as expected when the new item is added at the top.

i.e. $scope.gridOptions.data.unshift(newobj);

But if I do this $scope.gridOptions.data.push(newobj); It is not working.

I'm using this logic to shift the focus to the newly added row

            var rowIndex = $scope.gridOptions.data.length-1;
            var colIndex = 1;
            $scope.gridApi.cellNav.scrollToFocus($scope.gridOptions.data[rowIndex], $scope.gridOptions.columnDefs[colIndex]);

The newly added row is not visible. But if I scroll down to the bottom I'm able to see the new row.

Kannan Thangadurai
  • 1,117
  • 2
  • 17
  • 36
Anand MP
  • 121
  • 1
  • 2
  • 13
  • This is definitely an issue with `ui-grid`, here is a [plnkr with workaround](http://plnkr.co/edit/aRxPxeJAQTJaeS2xcsq8?p=preview), but this doesn't seem to be a good solution. – Stanislav Kvitash Dec 19 '17 at 10:23
  • I am facing the same problem, do you have any update ? With this workaround, new line is not entirely visible – isy Feb 02 '18 at 14:48

0 Answers0