Important Notice - Forums is archived
To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Scrollable Panel : setScrollTop
Hi,
I have a scrollable panel, containing varous components.
I'd like to be able to ensure that a given component is visible, when an event occurs somewhere else in the application.
I've tried to use element.scrollIntoView() (on the client/widget side), but that only *seems* to work if the immediate parent is scrollable (and in my case, it isn't).
It seems to me, then, that the "right" way to do it is to use Panel.setScrollTop(int pixelValue). Ahh - searching the forum, I find a newish ticket (1847) that's relevant - my current question is, how do I find the right value for pixelValue? (scrollTo(Component) would be ideal!)
I imagine I'm going to have to do a little widget programming : given a panel and a (contained) component, how do I find the necessary pixel offset?
Cheers,
Charles.
Hi!
I'm afraid there is no way to determine the height of components on the server side. You could guess the size or resolve it manually and hard code it. But that's a dirty hack.
That #1847 really should have been implemented ages ago. I think it shouldn't even be a hard one. How about promising me a beer at next Vaadin Meetup and I'll fix it for you by tomorrow ;-)
cheers,
matti
Well, forget the beer, we have some better stuff here
http://twitpic.com/1lc8vv
and here
http://dev.vaadin.com/ticket/1847#comment:2
Let's consider it as a bugfix so you can use it with next bugfix release that we'll build early next week.
cheers,
matti
Hi Matti,
You are a Gent and a Scholar, and I won't hear otherwise from anyone.
Seriously, thanks - I owe you a beverage or two when our paths next cross.
Cheers,
Charles.