{"action":"created","issue":{"url":"https://api.github.com/repos/angular-ui/ng-grid/issues/2505","labels_url":"https://api.github.com/repos/angular-ui/ng-grid/issues/2505/labels{/name}","comments_url":"https://api.github.com/repos/angular-ui/ng-grid/issues/2505/comments","events_url":"https://api.github.com/repos/angular-ui/ng-grid/issues/2505/events","html_url":"https://github.com/angular-ui/ng-grid/issues/2505","id":53693494,"number":2505,"title":"How to get the visible row index?","user":{"login":"arjan123","id":409628,"avatar_url":"https://avatars.githubusercontent.com/u/409628?v=3","gravatar_id":"","url":"https://api.github.com/users/arjan123","html_url":"https://github.com/arjan123","followers_url":"https://api.github.com/users/arjan123/followers","following_url":"https://api.github.com/users/arjan123/following{/other_user}","gists_url":"https://api.github.com/users/arjan123/gists{/gist_id}","starred_url":"https://api.github.com/users/arjan123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arjan123/subscriptions","organizations_url":"https://api.github.com/users/arjan123/orgs","repos_url":"https://api.github.com/users/arjan123/repos","events_url":"https://api.github.com/users/arjan123/events{/privacy}","received_events_url":"https://api.github.com/users/arjan123/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-07T22:57:11Z","updated_at":"2015-01-08T14:03:37Z","closed_at":null,"body":"Suppose I want to persist the current selection based on the row index.\r\nHow can I get the visible rowindex of the currently selected row?"},"comment":{"url":"https://api.github.com/repos/angular-ui/ng-grid/issues/comments/69182485","html_url":"https://github.com/angular-ui/ng-grid/issues/2505#issuecomment-69182485","issue_url":"https://api.github.com/repos/angular-ui/ng-grid/issues/2505","id":69182485,"user":{"login":"steverA","id":9431902,"avatar_url":"https://avatars.githubusercontent.com/u/9431902?v=3","gravatar_id":"","url":"https://api.github.com/users/steverA","html_url":"https://github.com/steverA","followers_url":"https://api.github.com/users/steverA/followers","following_url":"https://api.github.com/users/steverA/following{/other_user}","gists_url":"https://api.github.com/users/steverA/gists{/gist_id}","starred_url":"https://api.github.com/users/steverA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/steverA/subscriptions","organizations_url":"https://api.github.com/users/steverA/orgs","repos_url":"https://api.github.com/users/steverA/repos","events_url":"https://api.github.com/users/steverA/events{/privacy}","received_events_url":"https://api.github.com/users/steverA/received_events","type":"User","site_admin":false},"created_at":"2015-01-08T14:03:37Z","updated_at":"2015-01-08T14:03:37Z","body":"My current solution (given a row in hand) is to march through the gridOptions.data and compare $$hashKey. This assumes you do not prohibit their use:\r\n\r\n    $scope.findIndex = function(row) {\r\n        // find real row by comparing $$hashKey with entity in row\r\n        var rowIndex = -1;\r\n        var hash = row.entity.$$hashKey;\r\n        var data = $scope.gridOptions.data;     // original rows of data\r\n        for (var ndx = 0; ndx < data.length; ndx++) {\r\n            if (data[ndx].$$hashKey == hash) {\r\n                rowIndex = ndx;\r\n                break;\r\n            }\r\n        }\r\n        return rowIndex;\r\n    };"}}