2014-12-02 75 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