angular-data-grid / angular-data-grid.github.io

Light and flexible Data Grid for AngularJS applications.
http://angular-data-grid.github.io/demo/bootstrap/
112 stars 50 forks source link

Refresh grid after delete #55

Open AnishLushte07 opened 7 years ago

AnishLushte07 commented 7 years ago

Hi, I'm using server pagination in grid . after deleting one user i'm calling default refresh method but it is not fetching data from server. and if i called refresh with 'isDefaultSort' - 'true' it throws error 'digest already in progress' Please help, thanks in advance.

Bilalriazwork commented 7 years ago

@AnishLushte07 you want to grid data reload after delete ? In my case i use following method, it's working successfully. you will try it... Thanks

Add this code success function where you was assign JSON to grid. $scope.refresh = true; $timeout(function () { $scope.refresh = false; }, 0);

$scope.gridOptionsPaymentDetail.data = angular.fromJson(response.data);

Bilalriazwork commented 7 years ago

And also create $timeout object in top of [ ] angular js, before using it

AnishLushte07 commented 7 years ago

@Bilalriazwork Thanks for solution but in my case i'm calling default gridActions refresh method which internally calls reloadGrid. But the problem is that reload grid is not making call to fetch updated data.

Bilalriazwork commented 7 years ago

@AnishLushte07 Yes i was did gridActions refresh method. but it's not work. in my case i used above method. it is working good. It is getting update data after transaction.

stodolos commented 5 years ago

The reason that calls to refresh do not work is that the location of the page isn't changing (vs a filter or page number change), and the $locationChangeSuccess listener is what triggers the call to onChangeStateOrLocation, which in turn makes the call out to the server to happen. I wound up altering dataGrid.js to force a call to the onChangeStateOrLocation method.