2017-06-01 59 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