vaadin / vaadin/framework

Scrollbars in a filtered TreeTable

Open
#5,321 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Stale v7
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Originally by whahn


This may be related to https://github.com/vaadin/framework/issues/2087.

If a filter filters out everything from a TreeTable, the currently visible scrollbar stays. If the same is done with an ordinary Table, the scrollbar vanishes as expected.

Sample code:

package test;

import com.vaadin.annotations.Title;
import com.vaadin.data.Container.Filter;
import com.vaadin.data.Item;
import com.vaadin.data.util.IndexedContainer;
import com.vaadin.server.VaadinRequest;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.TreeTable;
import com.vaadin.ui.UI;
import com.vaadin.ui.VerticalLayout;

@Title("blargh")
public class TestUI extends UI {

    @Override
    protected void init(VaadinRequest request) {
        VerticalLayout mainLayout = new VerticalLayout();
        mainLayout.setWidth("800px");
        mainLayout.setHeight("450px");

        final IndexedContainer container = new IndexedContainer();
        container.addContainerProperty("asdf", Integer.class, null);
        for (int i = 0; i < 100; i++) {
            Item item = container.addItem(i);
            item.getItemProperty("asdf").setValue(i);
        }

        TreeTable tt = new TreeTable(null, container);
       _ Table tt = new Table(null, container); _ all is well

        tt.setSizeFull();

        Button b = new Button("filter everything");
        b.addClickListener(new Button.ClickListener() {
            @Override
            public void buttonClick(ClickEvent event) {
                container.addContainerFilter(
                        new Compare.Equal("asdf", "never matches"));
            }
        });
        mainLayout.addComponents(b, tt);
        mainLayout.setExpandRatio(tt, 1);

        setContent(mainLayout);
    }

}

Imported from https://dev.vaadin.com/ issue #14036

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied TreeTable sample and compare its filtering behavior with the ordinary Table using IndexedContainer. Trace how TreeTable handles an empty filtered container and updates its visible scrollbar. Done means the scrollbar disappears after the filter removes every item, matching Table behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.