简体   繁体   English

AngularJS ngTable在很多数据上都很慢

[英]AngularJS ngTable is slow on lot of data

I have a data massive with lot of data and try to display this data in table at AngularJS (with filtering and sorting). 我有一个包含大量数据的数据,并尝试在AngularJS的表格中显示这些数据(带过滤和排序)。 For this purpose I try to use ng-Table, but when data is too much (> 1000 rows) it start slowing on remote server, when data is too too much (> 5000 rows) the page with this table not even load at localhost machine. 为此我尝试使用ng-Table,但是当数据太多(> 1000行)时,它会在远程服务器上开始减速,当数据太多(> 5000行)时,带有此表的页面甚至不会加载到localhost机。 As I understand for filtering and sorting need to load all data from database, may be anybody know some trick and not load all data. 据我所知,过滤和排序需要从数据库加载所有数据,可能是任何人都知道一些技巧而不加载所有数据。 Or may be anybody know another table plugin for Angular. 或者可能是任何人都知道Angular的另一个表插件。

Thanks for any help. 谢谢你的帮助。

The info you need is here: http://tech.small-improvements.com/2013/09/10/angularjs-performance-with-large-lists/ 您需要的信息在这里: http//tech.small-improvements.com/2013/09/10/angularjs-performance-with-large-lists/

Recommendations are: 建议是:

  1. Paginate the rows, they can't see all 2000 rows at one time anyway 将行分开,无论如何都无法一次看到所有2000行
  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 使用ng-if而不是ng-show来获取其他模板
  6. Do not use AngularJS directives ng-mouseenter, ng-mouseleave, etc. 不要使用AngularJS指令ng-mouseenter,ng-mouseleave等。
  7. Tuning hint for filtering: Hide elements with ng-show that are excluded 调整过滤提示:隐藏排除了ng-show的元素
  8. Tuning hint for filtering: Debounce input 调整提示过滤:去抖动输入

Your filtering and sorting is likely the problem, apply filters in controllers and sort them there too. 您的过滤和排序可能是问题,在控制器中应用过滤器并在那里对它们进行排序。

Recently I start working on this new table component #ngTasty, here some example how use it by client side pagination/sorting http://zizzamia.com/ng-tasty/#Table and server side pagination/sorting http://zizzamia.com/ng-tasty/#TableServerSide . 最近我开始研究这个新表组件#ngTasty,这里有一些例子如何使用客户端分页/排序http://zizzamia.com/ng-tasty/#Table和服务器端分页/排序http:// zizzamia。 com / ng-tasty /#TableServerSide If it's still slow I will be happy to work around and improve the performance. 如果它仍然很慢,我将很乐意解决并提高性能。

For best user experience and to deal with big data, I will suggest wither going with infinite scroll or Pagination. 为了获得最佳用户体验并处理大数据,我建议使用无限滚动或分页。

This is a good work for the angular (Infinite scroll) http://www.michaelbromley.co.uk/blog/108/paginate-almost-anything-in-angularjs 这是一个很好的工作角(无限卷轴) http://www.michaelbromley.co.uk/blog/108/paginate-almost-anything-in-angularjs

For pagination, a good article http://www.michaelbromley.co.uk/blog/108/paginate-almost-anything-in-angularjs 对于分页,一篇好文章http://www.michaelbromley.co.uk/blog/108/paginate-almost-anything-in-angularjs

Try with these. 试试这些。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM