Saving row data with AngularJS ui-grid $scope.saveRow

后端 未结 3 2301
不思量自难忘°
不思量自难忘° 2021-02-09 22:12

I\'m working on a small frontend application which will show various product shipping data in a ui-grid.

I have the following code:

HTML:

3条回答
  •  悲哀的现实
    2021-02-09 22:57

    I had actually used the code submitted by punkologist and it was indeed working but there seemed to be errors in the console on resolving promise after including $interval.

    I guess the following is the appropriate code to make it run error free. Hope it works.

    $scope.saveRow = function( rowEntity ) {
    
    var promise = $q.defer();
    $http.put('/Home/UpdateRow',row).success(function(){
    $interval(function(){
         promise.resolved();
         },3000, 1)
    }).error(promise.reject);
    
    $scope.gridApi.rowEdit.setSavePromise($scope.gridApi.grid, rowEntity, promise);
    };
    

提交回复
热议问题