vaadin / vaadin/framework

Infinite scrolling generic component

Open
#8,711 9 comments 11 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement needs design
Dominant language
Java
Stars
1.8k
Forks
717
Avg merge
2d 6h
Merged PRs (30d)
3

Description

With the new data provider and query callbacks, Grid and ComboBox had become very powerful components when dealing with a backend datasource with a huge number of items.

It would be really great then to have an extendable generic component to extend which provides an easy interface to the infinite scrolling behavior, without dealing with design context and connectors.

Something to use like this:

public class ListComponent<T> extends InfiniteScrolling<T> {

    public ListComponent(ComponentContainer root) {
        this.setDesignRoot(root);
        this.addNewItemsListener(event -> {
            event.getItems().forEach(item -> {
               root.addComponent(this.itemComponentGenerator.apply(item));
            });
        });
    }

}

ListComponent<Issue> issueList = new ListComponent<>(new VerticalLayout());
issueList.setDataProvider(issueBackendDataProvider);
issueList.setItemComponentGenerator(issue -> {
    HorizontalLayout issueLayout = new HorizontalLayout();
    // ...
    return issueLayout;
});

and have the InfiniteScrolling handle data provider querying and sorting and filtering when necessary.

This would permit to build list views like GitHub's issues:

screen shot 2017-03-01 at 08 47 45

or StackOverflow's tag list:

screen shot 2017-03-01 at 08 48 58

(I know they use pagination, so the component might have the user choose if use pagination or infinite scrolling).

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 by reviewing the existing Grid and ComboBox data-provider, query-callback, sorting, and filtering behavior. Then clarify the API and scope for a generic component supporting item generation and either infinite scrolling or pagination. Done should include a documented, extendable component with examples covering the proposed list-view use case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.