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

Cannot read property 'find' of null

Open shader opened this issue 12 years ago • 17 comments

I'm getting an error when I use an ng-grid inside of a ui.router template and use the $state.go() method to transition:

TypeError: Cannot read property 'find' of null at self.setDraggables (ng-grid-2.0.11.debug.js:1040:37) at angular.js:14158:28 at completeOutstandingRequest (angular.js:4337:10) at angular.js:4638:7

If I manually type in a different routing url, the error does not occur. When I use $state.go(), it seems that the relevant method is being called twice for each table, once with grid.$root = null, and once with it properly set. Since I have grids on both of the templates, I'm not sure if its the grids I'm replacing or adding that have the problem. Based on the fact that self.setDraggables only seems to be called from $on('$destroy'), its probably the former.

shader avatar Jul 01 '14 19:07 shader

Same issue here since I use routes. Manual switch works, but this error block the routeChange.

Did you find a fix or something ?

Baart avatar Jul 09 '14 07:07 Baart

I'm seeing the same behavior. It appears the grid.$root is not being updated on programatic route changes before the draggables are being set (setDraggables() function: line 1048). I'm using location.path to change the route in order to get this error. I'm only getting this in chrome at present and I noticed that the code seems to be meant for FireFox based on the comments.

gwalter avatar Aug 13 '14 18:08 gwalter

I too have this same error. I am also using location.path.

chadreed-intl avatar Aug 13 '14 23:08 chadreed-intl

Same thing here: I upgraded from 2.0.7 to 2.0.12 today, and I now get this error when an ngGrid is removed from the DOM (with a ng-if or ng-repeat) while being rendered. On chrome only, not on firefox.

alahache avatar Aug 19 '14 12:08 alahache

+1

Crotery avatar Aug 29 '14 03:08 Crotery

Working plunker here with ui-router: http://plnkr.co/edit/ZgfJoq?p=preview (I checked in Chrome).

Closing unless you can show me how to reproduce.

c0bra avatar Sep 02 '14 17:09 c0bra

The same for me. You can check the error transitioning to an event passing a param. Here you can find your plunker forked with the issue: http://plnkr.co/edit/6AcF9VWXiPSnGN4lGUNO?p=preview

ghidoz avatar Sep 05 '14 13:09 ghidoz

+1

DealerCorp avatar Sep 16 '14 01:09 DealerCorp

Please create new release

kolesnik avatar Sep 18 '14 19:09 kolesnik

Could really use a new release with this fix, as we're still not ready to upgrade to "ui.grid"

himynameisdave avatar Sep 30 '14 17:09 himynameisdave

Adding weight to the issue as well - seeing the same problem on my end.

brian-slate avatar Oct 07 '14 17:10 brian-slate

+1

rbrcurtis avatar Oct 08 '14 14:10 rbrcurtis

+1

eshon avatar Nov 05 '14 03:11 eshon

+1

jkarthik08 avatar Nov 26 '14 12:11 jkarthik08

+1

ReinierGielen avatar Jan 19 '15 08:01 ReinierGielen

+1

lethalsheeep avatar Feb 04 '15 12:02 lethalsheeep

I'm closing since we're not supporting 2.x anymore. If anyone is willing to take on this, feel free to fork.

imbalind avatar Nov 12 '15 22:11 imbalind