加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJS ngTable在很多数据上都很慢

发布时间:2020-12-17 17:53:19 所属栏目:安全 来源:网络整理
导读:我有一个包含大量数据的数据,并尝试在AngularJS的表格中显示这些数据(带过滤和排序).为此我尝试使用ng-Table,但是当数据太多( 1000行)时,它在远程服务器上开始减速,当数据太多( 5000行)时,带有此表的页面甚至无法加载在localhost机器上.据我所知,过滤和排序
我有一个包含大量数据的数据,并尝试在AngularJS的表格中显示这些数据(带过滤和排序).为此我尝试使用ng-Table,但是当数据太多(> 1000行)时,它在远程服务器上开始减速,当数据太多(> 5000行)时,带有此表的页面甚至无法加载在localhost机器上.据我所知,过滤和排序需要从数据库加载所有数据,可能是任何人都知道一些技巧而不加载所有数据.或者可能是任何人都知道Angular的另一个表插件.

谢谢你的帮助.

解决方法

您需要的信息是: http://tech.small-improvements.com/2013/09/10/angularjs-performance-with-large-lists/

建议是:

  1. Paginate the rows,they can’t see all 2000 rows at one time anyway
  2. Render the list without data binding
  3. Do not use a inline method call for calculating the data
  4. Use two lists (one for the view to display,one as data source)
  5. Use ng-if instead of ng-show for additional templates
  6. Do not use AngularJS directives ng-mouseenter,ng-mouseleave,etc.
  7. Tuning hint for filtering: Hide elements with ng-show that are excluded
  8. Tuning hint for filtering: Debounce input

您的过滤和排序可能是问题,在控制器中应用过滤器并在那里对它们进行排序.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读