TreeTable go to element

I work with TreeTable. When the button is pressed, I want to expand the elements and select one of the elements inside the parent elements. But also I want to scroll the selected item. If the element is visible (all parent elements are extended), everything works fine. But if it is not visible at first (some parent elements are minimized), scrolling starts from the nearest visible parent.

My code looks something like this:

testButton.addListener(new Button.ClickListener() {

    public void buttonClick(ClickEvent event) {
       // expanding items for selected one
       ItemId parentId = selectedItem.getParent();
       while (parentId ! = null) {
         treeTable.setCollapsed(parentId , false);
         parentId = parentId.getParent();
       }
       // select the item
       treeTable.select(selectedItem);
       // scroll to seledcted item
       treeTable.setCurrentPageFirstItemId(selectedItem);
    }
});

Is there any solution for scrolling to the selected item and not to the nearest visible parent of the selected item?

Thanks in advance.

+3
source share
1 answer

I put this on the first line of the method:

treeTable.focus();

It looks like it works. (Vaadin 6.7.9)

0
source

All Articles