tepi / FilteringTable

An add-on for Vaadin. Extends the Vaadin Table component to provide optional filtering components below the table header.
http://vaadin.com/directory/#addon/filteringtable
Apache License 2.0
45 stars 53 forks source link

Infinity scoll in firefox #136

Closed SomMeri closed 5 years ago

SomMeri commented 5 years ago

Versions and Systems

Description of the bug

1.) Create filtering table that has many rows and loads slowly. Demo is using wait(100) inside column generator to simulate slow calculation. 2.) Use mouse wheel to slowly scroll down. When loading page shows up, scroll just a bit further and then stop moving the mouse.
3.) The table will continue slowly scrolling down till it reaches end of data.

Minimal reproducible example

@Theme("demotheme")
public class FilteringTableBugDemo extends UI {
    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();
        layout.addComponent(new Label("Use firefox 66.0.5 released 2019-05-09 and higher. Firefoxes from before work well. "));
        layout.addComponent(new Label("Scroll slowly down. When loading page shows up, scroll just a bit and then stop.  The table will continue scrolling till infinity."));
        table(layout);

        setContent(layout);
    }

    @SuppressWarnings("deprecation")
    private void table(VerticalLayout layout) {
        FilterTable table = new FilterTable();
        table.addContainerProperty("col1", String.class, "");
        table.addContainerProperty("col2", String.class, "");
        table.addContainerProperty("col3", String.class, "");

                // slowly loading column - causes the but
        table.addGeneratedColumn("col4", (t, itemId,columnId) -> {
                sleep(100);
                return "generated " + itemId ==null ? null : itemId.toString();
            }
        );

        Container container = table.getContainerDataSource();

        // many rows
        for (int i = 0; i < 5000; i++) {
            String itemId = "row_" + i;
            Item item = table.addItem(itemId);
            item.getItemProperty("col1").setValue("another " + i);
            item.getItemProperty("col2").setValue("aaaa " + i);
            item.getItemProperty("col3").setValue("bbbb " + i);

        }

        layout.addComponent(table);

    }

    protected void sleep(int time) {
        Object lock = new Object();
        synchronized (lock) {
            try {
                lock.wait(time);
            } catch (Throwable e) {
                System.out.println(e);
            }   
        }
    }

    @WebServlet(urlPatterns = "/bug/*", name = "BugReportUIServlet", asyncSupported = true)
    @VaadinServletConfiguration(ui = FilteringTableBugDemo.class, productionMode = false)
    public static class DemoUIServlet extends VaadinServlet {
    }

}
SomMeri commented 5 years ago

Closing this, since I realized filtering table inherits vaadin table and tried it with vaadin table only. The bug is reproducible in pure vaadin without filtering table. https://github.com/vaadin/framework/issues/11625