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

Enable easy way to reset scroll position when changing UI #2711

Closed
samie opened this issue Oct 18, 2017 · 1 comment
Closed

Enable easy way to reset scroll position when changing UI #2711

samie opened this issue Oct 18, 2017 · 1 comment

Comments

@samie
Copy link
Member

samie commented Oct 18, 2017

Many times when building UI with Flow component that changes the UI a lot, I want to reset the scroll to the top to simulate the page change instead of keeping the current position.

Example case:

        showAll = new Div();
        showAll.setClassName(CLASS_NAME + "__all");
        showAll.setText("show all...");
        showAll.addClickListener(e -> {
            UI.getCurrent().getPage().executeJavaScript("document.body.parentElement.scrollTop = 0;");
            /* ... update the UI... */  
        });

This is event more typical when using view navigation at the same time, like:

            UI.getCurrent().navigateTo("/");

This is so typical case that should be handled on the UI level method.

@mshabarov
Copy link
Contributor

@samie this can be achieved in the latest version of Flow by calling Component:: scrollIntoView(). Do you think we still need this ticket?

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

3 participants