ui-grid icon indicating copy to clipboard operation
ui-grid copied to clipboard

Can no longer use a string for the gridOptions.data property

Open lobo78 opened this issue 9 years ago • 8 comments

As of 4.0.3, I can no longer set the value of the gridOptions.data property as a string. For 4.0.2, it works perfectly, but in 4.0.3+, the grid is not rendered.

Here is a plunker that shows the issue: http://plnkr.co/edit/J9Xr3AuxI28FfxtYQstG

I'm not sure, but I believe the problem is inside the dataWatchFunction, because the newData array becomes undefined here.

lobo78 avatar Apr 10 '17 23:04 lobo78

I am facing the same issue with updating from 4.0.2 to latest version, any workaround for this?

RaeCai avatar Apr 17 '17 20:04 RaeCai

instead of using string in gridOptions.data, i am setting this value using service response. thanks for your clarification.

RaeCai avatar Apr 17 '17 21:04 RaeCai

I had the same problem and I've replaced the string binding with an empty array that was getting updated whenever I had the data ready.

paulcsiki avatar Apr 25 '17 22:04 paulcsiki

I've just run into this exact issue, first of all I believe that #6185 is a duplicate of this issue.

The problem was introduced here in v4.0.3 - where that fastWatch check was present previously it meant the newData value was provided by the scope watch instead of that block of code at the top of the function. This means that where previously the value would be extracted from scope directly it is now explicitly extracted from appScope with the following implications:

  • appScope may not necessarily be the same as (or even related to) $scope. The data is pulled from appScope but the watch is attached to $scope, resolving the string expression against each of these may produce different values.
  • the linked code resolving against appScope doesn't support "x.y.z" syntax, but resolving against $scope (as happens through the watches) does - #6185

I'd also like to note that the fastWatch option that features quite prominently in this area of the code doesn't appear to be documented anywhere.

StrangelyTyped avatar May 08 '17 19:05 StrangelyTyped

Same issue. downgraded to 4.0.2

trailblazer1414 avatar Jun 26 '17 14:06 trailblazer1414

@mportuga Thoughts?

caseyjhol avatar Sep 06 '17 21:09 caseyjhol

My guess is that it has to do with my changes to try and reduce the number of digest cycles: https://github.com/angular-ui/ui-grid/commit/205a2151e7d1d31dd6a78866d0413d97487769bf https://github.com/angular-ui/ui-grid/commit/e6ab96bbae7d1ec5848a65974f5addea8e012589 https://github.com/angular-ui/ui-grid/commit/56f0dc11978b9231373435d9e73da81375b5cda7

mportuga avatar Feb 07 '18 15:02 mportuga

@mportuga this was caused by https://github.com/angular-ui/ui-grid/commit/75f98c3eda3e46f14f9d924e6f5a6d6e35bcc2b5#diff-d586707ee1c4e842337e09afc6ebd587L87

We should be probably just restore the if ( self.grid.options.fastWatch ){....

Joel-Kornbluh avatar Mar 14 '18 21:03 Joel-Kornbluh