PrimeNG ——Let Filtering, Sorting and Lazy loading work together!

本文介绍了在PrimeNG数据表中,如何解决开启懒加载后排序和过滤功能失效的问题。通过在用户输入过滤条件或点击排序按钮时调用懒加载函数,同时执行过滤和排序操作,确保在大量数据下表格仍能流畅运行。
摘要由CSDN通过智能技术生成

Preface

Sorting, filtering is not working well with Virtual scroll (Lazy loading) in PrimeNG data table. Actually with large data set ,primeNg table become hang, for this resolution we can implement Virtual scroll(Lazy loading). But there is a problem that Sorting, Filtering is not working well with lazy loading.
When a user is inserting some value in the global filter input or the column filter input or clicking the sorting button with the lazy loading on, the lazy loading function will be invoked. So we can invoke filtering and sorting function when the lazy loading function invoked.

在PrimeNG的表格中,当我们开启懒加载,会有很多问题,比如不能排序,不能过滤,或者排序过滤不能在全部数据的范围内发生。然而如果加载大量数据, primeNG的表格就会阻塞, 为了解决这个问题,我们不得不使用懒加载。那么我们改如何解决这个问题呢?
当一个用户在全局搜索框或者列搜索框或者点击排序按钮时, 懒加载函数会被调用,因此我们可以在此时调用自定义的排序、过滤方法。

Resolution

Firstly, let’s create a function to implement global filtering
首先,我们写一个全局过滤的方法

filterGlobal(row, value) {
    for(let i=0; i<this.columns.length; i++) {
        let column: Column = 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值