-
Notifications
You must be signed in to change notification settings - Fork 63
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
bugfix: Make scrollToEnd to be more reliable #4498
Conversation
Note that the current implementation seems very hacky and inefficient (causes extra roundtrips to server) to me, but with this change the method becomes at least functional for common usage. |
SonarCloud Quality Gate failed.
|
Is this related to the scrollToIndex() GridTree problem? It would be amazing if this could be fixed 🙏 |
It doesn't look like that. The scrollToEnd seems to have totally custom implementation. Do you have a link to the original issue in TreeGrid that you are facing? |
Making |
@mstahv: There are more tickets I assume, but I am aware of these ones:
Also, this same customer, who reported the above using extensively the TreeGrid, and experienced these ones on TreeGrid:
@tomivirkki: It would be quite nice to tackle some of these too with the new API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review. Not really happy with the setTimeout
solution but I also couldn't find any alternatives.
Could you please add an integration test as mentioned in the contribution guidelines? GridScrollToPage
would be a good place to start.
getUI().ifPresent( | ||
ui -> ui.beforeClientResponse(this, ctx -> getElement() | ||
.executeJs("this.scrollToIndex(this._effectiveSize)"))); | ||
getUI().orElseGet(UI::getCurrent).beforeClientResponse(this, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about using getElement().getNode().runWhenAttached
to run the code when the component is actually added to a UI? There's a few other places in the component that use this approach.
.executeJs("this.scrollToIndex(this._effectiveSize)"))); | ||
getUI().orElseGet(UI::getCurrent).beforeClientResponse(this, | ||
ctx -> getElement().executeJs( | ||
"const el=this; setTimeout(()=>el.scrollToIndex(el._effectiveSize),0);")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"const el=this; setTimeout(()=>el.scrollToIndex(el._effectiveSize),0);")); | |
"setTimeout(() => this.scrollToIndex(this._effectiveSize));")); |
Closing the PR as stale as the last review comments have not been addressed in over a month. Please don't hesitate to open a new PR if you want to continue with this contribution. Thanks! |
Description
Fixes #4497
Type of change
Checklist