我试图在一个简单的网格上实现无限类型的滚动。Html是这样的:
<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-repeat一起使用
<tr ng-repeat="customer in customerVm.datasource | filter:customerVm.search" ng-model="customerVm.gridResult" "buffer-size="10">
<td>{{customer.customername}}</td>
</tr>然而,使用"ui-scroll“而不是ng-repeat,我得到了一个错误
Expected uiScroll in form of '_item_ in _datasource_' but got 'customer in customerVm.datasource | filter:customerVm.search'在如何使用Angular-ui scroll过滤数据方面,我是否遗漏了什么?我在scroll lib中看到了导致问题的代码行,如果有其他错误,它会抛出一个错误。
item in datasource这让我认为过滤在Angular-ui滚动中是不可能的。有什么想法吗?
发布于 2014-12-27 04:14:32
不幸的是,过滤还不能以这种方式进行,正如错误所暗示的那样。请参阅Readme file中的“参数”。您可以在数据源"get“函数中实现自己的过滤器。另请参阅官方examples。
https://stackoverflow.com/questions/27256252
复制相似问题