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

feat (template): implement scrollToEnd #1697

Open
gurachan opened this issue Feb 28, 2024 · 5 comments
Open

feat (template): implement scrollToEnd #1697

gurachan opened this issue Feb 28, 2024 · 5 comments
Assignees

Comments

@gurachan
Copy link

gurachan commented Feb 28, 2024

the renderCallback in rxfor and rxVirtualFor is quite a transition to work with.. i can do scroll to bottom in rxfor but on rxVirtualFor its glitching out. because rxVirtualFor keeps calling renderCallback. I think thats by design I guess.

whats the proper way to scroll to bottom. using rxVirtualFor.

i just want to start from the bottom.

this.subs.add(this.itemsRendered.subscribe((data) => {
      this.viewport.scrollToIndex(this.items$().length)
     //or 
      //this.elementRef.nativeElement.scrollTo(0, this.elementRef.nativeElement.scrollHeight);
    }))

both buggy.. like this.elementRef.nativeElement.scrollTo(0, this.elementRef.nativeElement.scrollHeight); works but sometimes its almost there. like u need a bit more scroll to be considered bottom. but on rxfor works fine.

this.viewport.scrollToIndex(this.items$().length) is aggressive to use at rxVirtualFor callback i cant even scroll anymore.

@gurachan gurachan changed the title [Question]: About @rx-angular/template/for [Question]: About virtual-scrolling Feb 29, 2024
@hoebbelsB
Copy link
Member

hey @gurachan what is the desired outcome? Having an initial scroll index? I've just merged #1693 which introduces a new input initialScrollIndex to the virtual scroller. Will be available with the next template version.

Does this help u?

@gurachan
Copy link
Author

gurachan commented Mar 1, 2024

hey @gurachan what is the desired outcome? Having an initial scroll index? I've just merged #1693 which introduces a new input initialScrollIndex to the virtual scroller. Will be available with the next template version.

Does this help u?

hmm the desire outcome is just to scroll at the bottom on initial load. ❤️ which your pr already solved.. ill just put 9999. I'm using it for logs.

[other desired outcome hmmm]

New boolean input to always scroll to bottom when the new data comes out?

  • maybe this input can be customizable like if its initial or always.

@hoebbelsB
Copy link
Member

what do you mean by always?

@gurachan
Copy link
Author

gurachan commented Mar 4, 2024

what do you mean by always?

[scrollToBottom]="always" // when new data comes it scrolls to bottom automatically
[scrollToBottom]="initial"  // scroll to bottom once.

Or just make it boolean ignore initial..

[scrollToBottom]="true" // when new data comes it scrolls to bottom automatically

it will be nice if its built in.. for log type usages.

@hoebbelsB
Copy link
Member

that's actually a good idea

@hoebbelsB hoebbelsB changed the title [Question]: About virtual-scrolling feat (template): implement scrollToEnd Apr 15, 2024
@hoebbelsB hoebbelsB self-assigned this Apr 15, 2024
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