Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anchor-like functionality in Vaadin to jump/scroll to a certain point

Is there a way in vaadin to scroll or jump to a certain point (e.g. a Label) inside a view (e.g. a Panel)when a button or link component is clicked? Similar to the anchors functionality on a website?

I'm using Vaadin 7.5.9

EDIT: I have a HorizontalSplitPanel. Its first component is a list of items where a user can make a selection. Is an item selected the second component of the HorizontalSplitPanel opens. The second component consists of a VerticalLayout containing a heading and a menu and a Panel. If there is a selection in the menu the Panel should be scrolled to the referred entry.

like image 903
st.huber Avatar asked Jan 13 '16 22:01

st.huber


1 Answers

There's an API on the UI class called scrollIntoView(Component). This is how one calls it

private Label result;

public void scrollToResult() {
  UI.getCurrent().scrollIntoView(result);
}
like image 104
Raffaele Avatar answered Sep 27 '22 16:09

Raffaele