Reduce the number of $watches created by ui-grid
Asked Answered
I

1

6

) first i just wanted to say thanks for this great project.

we integrated ui-grid as part of our table-grid , and for some unknown reason the amount of watches generated by the ui-grid is huge for the amount of data we trying to process.

for example : grid - 9 columns table with 20 rows of simple text based cells without any custom cell template

inspecting the $watches we getting amount of 960 watches.

trying to debug this issue we printed each element that has watch on him and most of the times we got this kind of elements :

[div#1445359168448-19-uiGrid-001Z-cell.ui-grid-cell.ng-scope.ui-grid-coluiGrid-001Z, context: div#1445359168448-19-uiGrid-001Z-cell.ui-grid-cell.ng-scope.ui-grid-coluiGrid-001Z]0: div#1445359168448-19-uiGrid-001Z-cell.ui-grid-cell.ng-scope.ui-grid-coluiGrid-001Zcontext: div#1445359168448-19-uiGrid-001Z-cell.ui-grid-cell.ng-scope.ui-grid-coluiGrid-001Zlength: 1__proto__: n[0]
 watchers 4

and each cell element got 2-4 watches.

we used simple data structure with basic columnDefs (field + display name) .

in most of our cases we don't need to watch for chances in specific grid cells.

is there anything we can do to reduce the number of $watches created by ui-grid ?

thanks in advance, elad.

Internecine answered 20/10, 2015 at 16:55 Comment(4)
Check this document - github.com/angular-ui/ui-grid/blob/master/misc/tutorial/…. There's an option named 'fastWatch' and setting this to true in your 'gridOptions' will make angular only watch for length of the data array and reference and not each particular index.Rockhampton
10x . i used the fastWatch option , but there was no change in the $watchs count :-(Internecine
Have you tried the other option mentioned in there 'flatEntityAccess'?Rockhampton
Yep . didn't saw any major effect. 10x :-)Internecine
I
0

As a conclustion - using the row*col $$watchers is used as part of performance boost to use Scrolling virtualization. any way to dismiss this behivor didnt work.

we have decided to use another approachby using smart table its lightweight and we love its idea not to encapsulate/hide the Table/Grid layout creation but instead its aset of directives (plugins) allow you to compose you table behavior in a declarative way.

using declarative way = using angular ng-repeat and see the table template directly its much simple and less much easy to give to CSS dev to add the style.

still we cannot use it as a complex grid infrastructure need for a CRM solution - for this reason we still looking for solution - maybe Telerik UI Table

elad.

Internecine answered 18/4, 2016 at 20:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.