2016-03-24 25 views
0

'da güncelledikten sonra görünüm sayfasının yeniden yüklenmesi açısal olarak yeni. Lütfen sorunu düzeltmede bana yardımcı olun. Ekrandaki kayıtların listelendiği ve veritabanında seçili kaydı seçmek ve güncellemek için bir onay kutusuna sahip olduğum display.html var. kayıt veritabanında güncellenir kez ben veritabanındaVeritabanındaki veriyi açısal

**Display.html:** 

    <div data-ng-controller="SKUIntegrationCtrl"> 

    <table class="table table-striped table-hover" width="100%" 
     style="overflow-x: scroll;"> 
     <tr> 
      <th><input type="checkbox" ng-model="selectedAll" 
       ng-click="checkAll()" /></th> 
      <th class="imagetableth"><b>UniqueID</b></th> 
      <th class="imagetableth"><b>Style</b></th> 
     </tr> 
     <tr 
      ng-repeat="datalist in datalists| pagination: curPage * pageSize | limitTo: pageSize"> 
      <td><input type="checkbox" ng-model="datalist.selected" 
       value="datalist.uniqueid"> </input></td> 
      <td class="val"><span class="glyphicon sort-icon">    {{datalist.uniqueid}} 
      </span></td> 
      <td class="val"><span class="glyphicon sort-icon">{{datalist.style}} 
      </span></td> 
     </tr> 
    </table> 
    <input type="button" name="Search" value="" 
     ng-disabled="authenticatedUser" ng-click="updateDataExtractionSAP()" 
     ng-class="enableDisableButton" /> 
     </div> 

**DisplayCtrl.js** 

    $scope.updateDataExtractionSAP = function (docName,ida3a11) { 
     SKUIntegrationService.updateDataExtractionSAP($scope, $http); 
     $route.reload(); 
     alert("Reload"); 
    }; 

**DisplayService.js** 

     this.updateDataExtractionSAP = function ($scope, $http) { 
     var SkuIntegrationSearchVo = {}; 

       $scope.uniqueIDArray = []; 
       angular.forEach($scope.datalists, function(datalist){ 
       if (!!datalist.selected){ 
        $scope.uniqueIDArray.push(datalist.uniqueid); 
       } 
       }) 

     SkuIntegrationSearchVo.uniqueIDList = $scope.uniqueIDArray; 
     var scopevalue = document.getElementById("contentlayout"); 
     var controllerScope = angular.element(scopevalue).scope(); 
     controllerScope.documentcriteriadata = SkuIntegrationSearchVo; 


     $scope.toggleloading(); 
     var promise = $http.post('/PMDBViewer/userlogin/LandingLayout/updateDataExtractionSAPList', SkuIntegrationSearchVo); 
     promise.success(function (data, status, headers, config) { 
      $scope.toggleloading(); 
      var scopevalue = document.getElementById("contentlayout"); 
      var controllerScope = angular.element(scopevalue).scope(); 
      controllerScope.datalists = data; 
      controllerScope.content = "SkuIntegrationSearchResult"; 
      $scope.showAdvPrdSearch = false; 
      $scope.showsearchresult = true; 
      alert("Selected records updated in DataExtractionToSAP table"); 
     }).error(function (data, status, headers, config) { 
      $scope.toggleloading(); 
      alert("error in advance Document Search"); 
     }); 
    }; 


Now i have an action method to update the records selected in check box in display.html to the database. It is working fine. Now i need to re-load the display.html with the newly update values in database. Please help me on this. i tried 

    $route.reload(); 

it seems not working 
+0

Sadece veri dosyalarını tekrar alamıyor musunuz? – sdfacre

+0

Lütfen kod snippet'inde bana yardımcı olun. –

+0

, büyük olasılıkla önce tüm DisplayCtrl.js'nizi gösterir – sdfacre

cevap

0

Sen işlev çağrısı ekleyerek başka işlevi içinde görüntülenecek veri alıyorsanız hangi bunu yapabilir içinde yeni güncellenen kayıtlarla Display.html yenilemeniz gerekir. Denetleyicinizde function getData(){...} function activate(){getData()} ve add activate(). Böylece her eklediğinizde güncelleme verileri sonda tekrar aktive etme fonksiyonunu çağırır.