Surendra Kandira

Surendra Kandira

  • 1.6k
  • 477
  • 29.7k

ng-table pagenation not update after delete or add new recor

Jun 2 2016 6:43 AM

I am using np table in angular for data binding. ng table show paging and total number of record but when I add new row or remove one row from data model in ng table. Total row is reflected but total number of record and paging not reflected.

I have used bleow code Any one can help me..

 
 
 
  1. $scope.viewDeleteTemplateModel = function (templateId, name) {  
  2.                if (parseInt(templateId, 10) <= 0) {  
  3.             $scope.bindPopUpMessages(Enum.AlertType.Error, "TemplateId must be greater than zero.");//showing smart popup alert  
  4.         } else {  
  5.             $scope.bindSmartAlert("<i class='fa fa-fw fa-reorder'></i> Template""Do you really want to delete the <strong>" + name + "</strong> template?", function () {  
  6.                 if ($scope.PropertyBag.SmartAlertResult && $scope.PropertyBag.SmartAlertResult === 1) {                      
  7.                     var request = "request={'OrganizationId':" + $scope.PropertyBag.OrganizationDetails.OrganizationId + ",'TemplateId':" + templateId + "}";  
  8.                     $RestService.deleteTemplate(request).success(function (result) {  
  9.                         if (result) {  
  10.                             var alertType = Enum.AlertType.Success;  
  11.                             var message = "The Template  <strong>" + name + "</strong> is deleted successfully.";  
  12.                             if (result.Result.Status !== 0) {  
  13.                                 alertType = Enum.AlertType.Error;  
  14.                                 message = "Opps! Something went wrong that's why the template  <strong>" + name + "</strong> is not deleted.";  
  15.                             } else {  
  16.                                 $scope.tableServerSide[tableId].data.Model.Items = _.without($scope.tableServerSide[tableId].data.Model.Items, _.findWhere($scope.tableServerSide[tableId].data.Model.Items, { TemplateId: templateId }));  
  17.                                 if ($scope.tableServerSide[tableId].Records !== undefined && $scope.tableServerSide[tableId].Records > 0)  
  18.                                 {  
  19.                                                                         $scope.tableServerSide[tableId].Records = $scope.tableServerSide[tableId].Records - 1;  
  20.                                 }  
  21.   
  22.                                 //$scope.getTemplatesList();  
  23.                             }  
  24.                             $scope.bindPopUpMessages(alertType, message);//showing smart popup alert                              
  25.                         }  
  26.                     }).error(function (err) {  
  27.   
  28.                     });  
  29.                 }  
  30.             });  
  31.         }  
  32.   
  33.     }; 

Answers (1)