2017-06-01 56 views
2

我有一個表格顯示大量的數據,並導致瀏覽器卡住。顯然,這是因爲大量的數據被傳遞。在這張表中處理了10000多個數據。角度虛擬滾動(vs-reapt)不適用於表格

我試圖使用「角度虛擬滾動」進行修復。但效果不佳。

<div class="col-md-8" id="events" vs-repeat="50"> 
    <br/> 

    <table class="table">   
    <thead> 
    <th>Select</th> 
    <th>Date</th> 
    <th>Time</th> 
    <th>Log Information</th> 
</thead> 
<tbody vs-repeat> 
    <tr ng-repeat="s in events"> 

    <!--<td style="display:none;">{{ s._id }}</td>--> 
    <td><input type="checkbox" ng-model="s.checked" ng-true-value="1" ng-false-value="0"></td> 
    <td> 
    <div > 
    <div class=""> 

     <i ></i>&nbsp;&nbsp;{{ s.dat }} 

    </div> 
    </div> 
    </td> 
    <td> 
    <div > 
    <div > 
     {{ s.tim}} 
    </div> 
    </div> 
    </td> 
    <td> 
    <div> 
    <div > 
     {{ s.details}} 
    </div> 
    </div> 
    </td> 
    </tr> 
</tbody> 
</table> 

控制器 -

$scope.events; 
    function getEventsOfUploadedFile() 
    { 
     Event.getUploadRead() 
     .success(function(event){ 
     $scope.events=event; 
     }) 
      .error(function (error) { 
       $scope.status = 'Unable to load event data: '; 
     }); 
    } 

誰能幫我解決這個問題。 感謝

+0

我想你使用的setTimeout – Sandeep

+0

見下文 – Sandeep

回答

0

使用超時象下面這樣:

$scope.events = []; 
function getEventsOfUploadedFile() 
{ 
    Event.getUploadRead() 
    .success(function(event){ 
     var i = 0; 
     function pushEvent(){ 
      setTimeout(function(){ 
       $scope.events.push(event[i]); 
       i++; 
       if(i < event.length){ 
        pushEvent(); 
       } 
      }, 0); 
     } 
    }).error(function (error) { 
     $scope.status = 'Unable to load event data: '; 
    }); 
} 
+0

我回答這個問題沒有解決friend.anyway感謝... – MSKP

+0

@MSKP D'不使用「VS '重複' – Sandeep

+0

@ Sandeep仍然不工作的朋友 – MSKP