Asarudeen A
Asarudeen A

Reputation: 59

Cell Navigation not working Properly in new added row of ui-grid angularjs

While clicking "Add Row" button, it added a new row in the top of ui-grid with focus of first column. After pressing Tab button its not going to Next Column of same row instead its going to next row column.

http://plnkr.co/edit/VYhhIpdUAUzoXr2RiYKG?p=preview Here is my code in [plnkr]

Pls Advice.

Upvotes: 1

Views: 1613

Answers (1)

CMR
CMR

Reputation: 933

You are trying to focus too fast. If you are using a timeout, everything works as expected.

setTimeout(function(){
      $scope.gridApi.cellNav.scrollToFocus($scope.gridOptions.data[0], $scope.gridOptions.columnDefs[0]);
}, 100)

Also you need to focus data[0] instead of the first index.

Here is your updated Plunkr.

Upvotes: 5

Related Questions