【问题标题】:Dir-paginate GET row count after filter - angularJs过滤后的Dir-paginate GET行数 - angularJs
【发布时间】:2017-01-06 11:17:12
【问题描述】:

我希望过滤后的行数出现在我的列表中。 使用 dir-paginate ,结果总是 5 (== itemsPerPage) 或者我有 > 5 行。 有谁知道我如何在我的 dir-paginate 中获取所有页面的行数?

<div>count filtered :  ({{ filtered.length }})</div>
<input type="text" class=" text-input form-control" ng-model="search.name"  placeholder="name">
<div class="col-md-6">
        <table class="table">
            <thead>
                <tr>
                    <th></th>
                    <th>Title</th>
                </tr>
            </thead>
            <tbody>
                <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">
                    <td>{{ person.name }}</td>
                </tr>
            </tbody>
        </table>
</div>
<dir-pagination-controls max-size="5"
         direction-links="true"
         boundary-links="true" class="pagination">
</dir-pagination-controls>

谢谢

【问题讨论】:

    标签: angularjs filter dirpagination


    【解决方案1】:

    您必须手动执行此行计数

    改变

     <tr dir-paginate="person in persons | filter:_this.search  | itemsPerPage:5  as filtered" pagination-id="excluded">
    

    <tr dir-paginate="person in filtered = (persons | filter:_this.search)  | itemsPerPage:5 " pagination-id="excluded">
    

    你可以通过filtered.length得到计数

    Ref

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-07
      相关资源
      最近更新 更多