1

it worked fine last time i check(two or three months ago) their is a variable called with the default boolean value false like below.

$scope.IsRowSelected = false;

And i should mention when the debugger runs on first time value set as true. But it come to delete function then the value reads the default value. i cant understand how to handle this error.

code is below :

 $scope.IsRowSelected = false;
   
$scope.gridOptions.onRegisterApi = function (gridApi) {
     $scope.gridApi = gridApi;
     gridApi.selection.on.rowSelectionChanged($scope, function (row) {
         //$scope.selectedEmpID = row.entity.id;
         debugger;
         $scope.selectedEntity = row.entity;
         $scope.Check = true;
         $scope.IsRowSelected = true;
         //in here it shows IsRowSelected as true
     });
}
 
$scope.DeleteEntity = function () {
     debugger;
     //when this funtion excecute the IsRowSelected = false
     if ($scope.IsRowSelected == true) {
         var selectedRow = $scope.selectedEntity;
     }
}
    
    
 

3
  • try using $timeout(function() { $scope.IsRowSelected = true; }) Commented Nov 9, 2018 at 5:27
  • still it's not working Commented Nov 9, 2018 at 5:41
  • i had check with backup and its working.Their are no any changes between two codes.Still i unable to find the issue Commented Nov 9, 2018 at 6:03

1 Answer 1

0

gridApi.selection.on.rowSelectionChanged function call when row is getting unselect, set noUnselect property to true,so row cant be unselected.

$scope.gridApi.selection.getSelectedRows();

use this code to get the selected row from the grid.

Working Fiddle

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.