Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.
Tree in a Panel scrolls to top when a new item is added
Using version 6.7.9. We are using a tree inside a panel with scroll set. Implemented a expandNodeListener and adding nodes whenever expand button is clicked(lazy loading). The issue is whenever items are added to the tree, the scrollbar goes to the top? How can this be avoided? Is there a workaround for this?
I think the lazy loading should be done inside the container, and not in the view. You could extend HierachicalContainer and override getChildren(Object itemId). When that is called, you fetch the data. You might have to override some other methods as well, as hasChildren(Object itemId) and something else.
About the scrolling itself don't know directly. Does it matter if you do tree.addItem() or tree.getContainer().addItem()?
Thanks for the reply. I am using Hierarchial Container and adding items to it in the expandNodeListener and as soon as I add items to the container the scroll bar reaches the top of the tree which is really very non-intuitive. Is this a bug? Or is there a work around to solve the scroll issue?
Does any one have the same scroll problem: adding items to HierarchialContainer, the tree scroll goes to top of tree? Please let me know.
I am having the same problem. Very annoying indeed.