emberjs / list-view

An incremental rendering list view for Ember.js
MIT License
465 stars 116 forks source link

Incorrect number of elements shown when element exceeds container height #238

Closed Geokoumpa closed 7 years ago

Geokoumpa commented 9 years ago

Hello,

I have implemented a multi-level nested tree of collapsible elements, by taking advantage of

heightForIndex

and

updateRows

Everything seemed to work as expected, until some of my data branches had a big number of descendants, such that the total height of the root element was greater than that of the container.

As I start scrolling, at some point, it stops functioning properly, as it shows less items than needed to fill the container area. I have verified that heightForIndex is calculated correctly and accurately. The calculation is done via

  heightForIndex: (idx)->
    entry = @get('content').objectAt(idx)
    if entry.get('collapsed')
      return @rowHeight * entry.get('selfAndDescendantsRows')
    else
      @rowHeight

where selfAndDescendatsRows is a computed property inside the model that populates the tree / list.

This is very disappointing because other than this issue, the whole system works impressively well, so any help would be much appreciated.

thanks!

stefanpenner commented 9 years ago

This is very disappointing because other than this issue,

ya it's a bummer, we will need to fix this. But a good scenario :)

tp commented 9 years ago

For a tree-view like structure I built a component (in-house), that has no nested list views, but rather just indents items based on their depth in a single list view.

The code slightly more complicated than the straightforward way, but uses much less elements than other approaches and is always fast, no matter how many nodes are open/visible.

Maybe that would work for you as well.

Geokoumpa commented 9 years ago

I would gladly try your component as well tp, thanks!

tim-evans commented 9 years ago

This will probably be fixed on the pack branch.

stefanpenner commented 9 years ago

This will probably be fixed on the pack branch.

maybe, im unsure about this specific use-case though. But i'll be working with @taras this week to fixup @krisselden's code so we can actually merge pack finally. At which point, we should likely add ^^ as a test case.

scooterlord commented 9 years ago

Hello. Any news on this one? Haivng the same issue and would be glad to have this solved!

rwjblue commented 7 years ago

I'm sorry we didn't get back to this previously, but at this point this repo is essentially unmaintained. Please use @html-next/vertical-collection or ember-collection for similar functionality.

Closing...