Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Pagination widget with lazy loading #55

Open
DSeeLP opened this issue Apr 3, 2021 · 2 comments
Open

[feature] Pagination widget with lazy loading #55

DSeeLP opened this issue Apr 3, 2021 · 2 comments
Assignees
Labels
enhancement New feature or request inventory Something related to the inventory/widget system

Comments

@DSeeLP
Copy link
Contributor

DSeeLP commented Apr 3, 2021

Is your feature request related to a problem? Please describe.
Currently to use the pagination with a database you need to load all entries and map them to a kelp item.

Describe the solution you'd like
A lazy Pagination class which has a type argument and needs an supplier and two functions.
The supplier returns the max page and the first function takes an int as the page and returns an array or list of the type. The second function takes an object of the type and returns a kelp item.

@PXAV
Copy link
Member

PXAV commented Apr 4, 2021

So you mean something like this?

class LazyPagination<T> {

  ...

  public int getMaxPage() { 
    return supplier.get(); 
  }

  public Collection<T> getWidgetsFor(int page) { ... }

  public KelpItem getItem(T type) { ... }

}

The idea of a lazy loading pagination is really good, you are right that loading all pages for a simple update is overkill. But what does the class type stand for in this case? Is it a widget type? Because then you couldn't render different database entries as different widget types anymore.

@DSeeLP
Copy link
Contributor Author

DSeeLP commented Apr 5, 2021

Yes i meant something like this. In my example the class type stands for the object obtained from the database.

@PXAV PXAV added enhancement New feature or request inventory Something related to the inventory/widget system labels Apr 7, 2021
@PXAV PXAV self-assigned this Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request inventory Something related to the inventory/widget system
Projects
None yet
Development

No branches or pull requests

2 participants