2014-12-02 73 views
2

我正試圖在一個簡單的網格上實現無限類型的滾動。 HTML是這樣的:過濾Angular-ui Scroll

<div class="text-center" style="background-color:#eee;"> 
    <H2 style="margin-top:0px;">Customer List</H2> 
    <hr /> 
    Search: <input ng-model="customerVm.search" /> <br /> <br /> 

    <table class="table table-hover" ui-scroll-viewport style="height:500px;"> 
     <tbody> 
     <tr ui-scroll="customer in customerVm.datasource" ng-model="customerVm.gridResult" "buffer-size="10"> 
       <td> 
     </tbody> 
    </table> 
</div> 

我想過濾的是基於搜索框模型網格,看起來很簡單。我通常只使用下面有NG重複

<tr ng-repeat="customer in customerVm.datasource | filter:customerVm.search" ng-model="customerVm.gridResult" "buffer-size="10"> 
       <td>{{customer.customername}}</td> 
      </tr> 

然而,隨着使用的「UI-滾動」,而不是NG-重複我得到一個錯誤

Expected uiScroll in form of '_item_ in _datasource_' but got 'customer in customerVm.datasource | filter:customerVm.search' 

我缺少的東西關於如何使用Angular-ui滾動過濾數據?我看到,是造成其拋出一個錯誤的問題,滾動lib中的行,如果有任何其他然後

item in datasource 

這讓我覺得,過濾是不可能的角UI滾動。任何想法的人?

回答

1

不幸的是,過濾不可能以這種方式進行,正如錯誤所示。請參閱Readme file中的「參數」。你可以在數據源「get」函數中實現你自己的過濾器。另見官方examples