Loading...
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.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

TreeTable scroll problem

Gaz Limebranch
9 years ago Jun 11, 2012 9:11am

Hi,

I've been banging my head on getting TreeTable auto-scroll to work but it seems to constantly miscalculate the scroll position when child nodes are added dynamically during node expand. I managed to keep scroll position by wrapping my TreeTable inside Panel which to my understanding is the only component that allows you to programmatically manage scrolling (implements Scrollable). Now the problem is that when I expand some node in the tree, panel/tree content height is not updated and last nodes in the tree are hidden.

Is there any way disable auto-scrolling in TreeTable or get panel wrap solution to recalculate panel content and TreeTable height?

I have following setup with Vaadin 6.7.9:

- TreeTable with depth of 2
- Every node in TreeTable is a layout which all can have different heights
- Child elements are added into TreeTable when their parent is expanded for the first time

TreeTable works by itself except when expanding the parent nodes for the first time (add new nodes into tree), auto-scroll moves you randomly somewhere in the tree and most of the cases you cannot even see the expanded node after auto-scroll.

I got rid of auto-scroll problems by wrapping the TreeTable inside Panel. So now when the component hierarchy is Panel -> VerticalLayout (default content of Panel) -> TreeTable. My next problem is that when nodes are expanded, VerticalLayout and TreeTable body heights are not updated and last nodes in the tree are hidden.

I partly resolved this problem in Firefox by setting:

.v-table-body {
position: absolute !important;
}

but this hides the whole tree in IE8 and in Firefox none of the tree nodes are hidden but when expanding the last tree node, scroll position cannot be restored using panel.setScrollTop() . Firefox also adds horizontal scrollbar when setting the style above.

If you have any suggestions on what should I try next, please answer. I'm out of tricks at the moment ...

Gaz Limebranch
9 years ago Jun 12, 2012 11:19am
Gaz Limebranch
9 years ago Jun 13, 2012 12:25pm
Ozgun Alan
9 years ago Jun 20, 2012 5:35pm
Gus Heck
9 years ago Aug 27, 2012 4:39pm
Annu Thapa
5 years ago Jul 18, 2016 6:01pm