【问题标题】:dir-pagination directive angularjs : Update pagination after filteringdir-pagination 指令 angularjs:过滤后更新分页
【发布时间】:2016-05-09 09:34:19
【问题描述】:

我使用 dir-pagination 指令进行分页,它工作正常,但过滤分页时没有更新

下面是我的代码:

     <tbody dir-paginate="booking in bookinglist | itemsPerPage: 30 | orderBy:sortKey:reverse">
        <tr ng-repeat="orders in booking.order | filter: booking_filter | dateRange: startDate : endDate | orderBy:sortKey:reverse">
          <td>{{booking.customer_name}}</td>
          <td>{{orders.order_id}}</td>
          <td>{{orders.service_name}}</td>
          <td>{{orders.employee_name}}</td>
          <td>{{orders.area_name}}</td>
          <td>{{orders.booking_date | date:"dd/MM/yyyy"}}</td>
          <td>{{orders.booking_time}}</td>
          <td>{{orders.status}}</td>
          <td class="g-btn-full-width">
            <button type="button" ng-click="EditBooking(orders._id)" class="btn btn-primary"><span class="fa fa-pencil"></span></button>
            <button type="button" ng-click="DeleteBooking(orders._id)" class="btn btn-danger"><span class="fa fa-trash"></span></button>
            <button type="button" ng-click="InvoiceGenerate(orders._id)" class="btn btn-warning">Invoice</button>
          </td>
        </tr>
      </tbody>
    </table>
    <dir-pagination-controls>
        max-size="5"
        direction-links="true"
        boundary-links="true"
    </dir-pagination-controls>
    </div>

我坚持这个...帮助将不胜感激

【问题讨论】:

  • 所以当你切换页面时结果不会更新?
  • 过滤时...基于过滤结果分页未更新
  • 不要认为这是问题所在,但是您的 html 已关闭,因此属性是元素的子元素,而不是在元素上定义的。它们可能不是指令正确渲染所必需的,但值得清理以确保。
  • @Nodemon 你能分享booking_filter函数吗?
  • 如何加载您的 bookingList ?异步?整个在同一时间还是分页?

标签: angularjs pagination


【解决方案1】:

你必须在你的标签中使用filter: booking_filterdir-paginate

<tbody dir-paginate="booking in bookinglist | filter: booking_filter | itemsPerPage: 30 | orderBy:sortKey:reverse">

【讨论】:

  • 我正要回答同样的问题!希望你在它到期之前得到赏金
【解决方案2】:

在过滤器函数中更新您的预订列表对象。 由于更新预订列表对象的双向数据绑定可能会重新计算过滤后的分页。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-15
    • 2015-07-02
    • 2017-01-06
    • 1970-01-01
    • 1970-01-01
    • 2017-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多