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

Prefered way to force redraw of rows/items. #10

Open
ktersius opened this issue Jun 22, 2017 · 5 comments
Open

Prefered way to force redraw of rows/items. #10

ktersius opened this issue Jun 22, 2017 · 5 comments

Comments

@ktersius
Copy link

ktersius commented Jun 22, 2017

Currently when options like item sizes are changed I have to somehow force the component to redraw. It seems that emitting the options itself is not enough to trigger any sort of redraw.

If I only emit options they seem to only take effect as I scroll through the items and the rows are updated.

For now I'm emitting an empty array and then right after that the data array, this seems to make it redraw but it feels messy.

 subs.push(this.debounceResize$.subscribe(() => {
        observer.next([]);
        observer.next(curData);
      }));
@dinony
Copy link
Owner

dinony commented Jul 4, 2017

Hi @ktersius, yeah, this is an issue I am aware of and I will look into it. The reason I did not implement it in the first place is that I was unsure, whether it could harm the performance or not.
But as there seems to be a use case, I will evaluate the practicability.
Thanks!

@dinony dinony added this to the Maintenance August 2017 milestone Aug 10, 2017
@musicq
Copy link

musicq commented May 8, 2018

Yup, I met the same problem today, but I solved it by this tricky way.

In templates

<od-virtualscroll [vsData]="data$" [vsOptions]="options$">
...
</od-virtualscroll>

In components

data$ = new Subject<number[]>();

change() {
    // use this to force redraw
    this.data$.next([]);
    this.data$.next(new Array(100).fill(0).map(x => Math.floor(Math.random() * 1000)));
}

@dinony
Copy link
Owner

dinony commented May 8, 2018

Yeah thanks. But it's still something, which needs to be addressed in future. I hope I will find some time for another maintenance/feature request round.

@furlongce
Copy link

Have you had a chance to look into this? I'm facing a similar issue.

@dinony
Copy link
Owner

dinony commented Aug 3, 2018

Not yet, but I (or someone else 👍) will!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants