Scrollbars in a filtered TreeTable
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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