AngularJS ngTable 在处理大量数据时速度很慢

标签 angularjs ngtable

我有大量数据,并尝试在 AngularJS 的表格中显示这些数据(带有过滤和排序)。为此,我尝试使用 ng-Table,但是当数据太多(> 1000 行)时,它在远程服务器上开始变慢,当数据太多(> 5000 行)时,包含此表的页面甚至不会在本地主机上加载机器。据我了解,过滤和排序需要从数据库加载所有数据,可能有人知道一些技巧而不加载所有数据。或者可能有人知道 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

您的过滤和排序可能是问题所在,请在 Controller 中应用过滤器并在那里对它们进行排序。

关于AngularJS ngTable 在处理大量数据时速度很慢,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25219103/

相关文章:

javascript - 错误 : 'undefined' is not a constructor (evaluating 'new ngTableParams' )

angularjs - Ngtable:需要明确的表头并选择过滤器

angularjs - 我们可以使用 TestCafe 来自动化 angular 或 reactjs 应用程序吗?

javascript - Angular JS-尝试创建视频选择器 "angular way"

html - 当表格宽度改变时使用平滑过渡

angularjs - 如何从 angularjs 中的表中导出整个数据(包括所有分页数据)?

angularjs - ngTable.reload() 无法刷新 ng-table 第二次不显示新数据

html - 通过下拉框更改网页字体

angularjs - grails 2.3.4 结合angular js的智能文件夹结构

javascript - angularJS:动态 header 排序不起作用