angular-ui / ui-scroll

Unlimited bidirectional scrolling over a limited element buffer for AngularJS applications

Home Page:http://angular-ui.github.io/ui-scroll/demo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError: Cannot read property '0' of undefined

kirillbashtenko opened this issue · comments

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

@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!

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

@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!

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

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

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

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

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