Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property '0' of undefined #159

Closed
kirillbashtenko opened this issue Jun 19, 2017 · 8 comments
Closed

TypeError: Cannot read property '0' of undefined #159

kirillbashtenko opened this issue Jun 19, 2017 · 8 comments

Comments

@kirillbashtenko
Copy link

kirillbashtenko commented Jun 19, 2017

Hi, can you help me ?
what's wrong with this table link
????

@kirillbashtenko kirillbashtenko changed the title Ng-repeat in ui-scroll-td TypeError: Cannot read property '0' of undefined Jun 19, 2017
@dhilt
Copy link
Member

dhilt commented Jun 19, 2017

@kirillbashtenko Looks like it doesn't work, the combination of ui-scroll/ui-scroll-td and ng-repeat inbetween. This works for ui-scroll-th, but not for ui-scroll-td. While we are looking into it, you can do a workaround without ng-repeat:

<td ui-scroll-td class="col1">{{item["col1"]}}</td>
<td ui-scroll-td class="col2">{{item["col2"]}}</td>
...

Thanks for the issue repro!

@kirillbashtenko
Copy link
Author

@dhilt thank you, for your quick response, but that wouldnt work in my case, i have dynamic columns and rows, so probably i'm stuck right now.

@dhilt
Copy link
Member

dhilt commented Jun 20, 2017

@kirillbashtenko I pushed the fix into grid-scopes-wrapping branch. That was the issue of race condition around ui-scroll-td linking, and it is possible to say that the ng-repeate wrapping scope was the cause. I want to think a little bit more about the problem, so the code is in branch. It includes distributive files and the demo . It would be great if you could try it!

@kirillbashtenko
Copy link
Author

@dhilt yeah , thank you, it's great , working as i expect right now!

@dhilt
Copy link
Member

dhilt commented Jun 20, 2017

@kirillbashtenko Ok, you can use the branch code while I'm preparing it for 'master'.

@kirillbashtenko
Copy link
Author

kirillbashtenko commented Jun 21, 2017

@dhilt after detail investigation i found a really big performance problems , in each tbody > tr i saw:
screen and in your demo also and as i understand it depends on number of columns, but performance on small tables is ok. In some of my tables i have more than 100 columns(i even remove all unnecessary watchers with one way binding ) and it works worst than without ui-scroll.

@dhilt
Copy link
Member

dhilt commented Jun 21, 2017

@kirillbashtenko Yes, it looks not good... By the way if you try 100x500 double ng-repeat

<table style="height: 300px; overflow: scroll; display: grid; width: 400px;">
  <tr ng-repeat="row in rows"><td>{{row}}</td><td ng-repeat="col in columns">{{col}}</td></tr>
</table>

...this renders pretty slow and the scroll proccess is being affected itself. Then just add two simple bindings class="{{row}}" and class="{{col}}" and get rendering time 1/5 slower. The ui-scroll (especially with the ui-scroll grid) is heavier I guess. The performance is the core issue and I don't see a simple way to imrove it in the actual situation.

Regarding <!-- ngRepeat: .... The example with two cross ng-repeats has the same behaviour, this is unchangeable internal ng-repeat stuff I guess.

@dhilt
Copy link
Member

dhilt commented Jul 7, 2017

Closing the issue since the fix was merged into 'master' and v1.6.2 is released...

@dhilt dhilt closed this as completed Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants