Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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). 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. 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.

Thanks for any help.

like image 384
JustIce Avatar asked Jan 10 '23 01:01

JustIce


1 Answers

The info you need is here: 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
  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

Your filtering and sorting is likely the problem, apply filters in controllers and sort them there too.

like image 121
Joshua Robinson Avatar answered Jan 21 '23 19:01

Joshua Robinson