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

Enhanced Selection doesn't work with GridLazyDataView #109

Open
deyaeddin opened this issue Jan 8, 2024 · 3 comments
Open

Enhanced Selection doesn't work with GridLazyDataView #109

deyaeddin opened this issue Jan 8, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@deyaeddin
Copy link

when using Enhanced Selection with Lazy Data Provider, this exception is thrown.

java.lang.IllegalStateException: GridListDataView only supports 'ListDataProvider' or it's subclasses, but was given a 'AbstractBackEndDataProvider'. Use either 'getLazyDataView()', 'getListDataView()' or 'getGenericDataView()' according to the used data type. at com.vaadin.flow.data.provider.AbstractDataView.verifyDataProviderType(AbstractDataView.java:114) at com.vaadin.flow.data.provider.AbstractDataView.<init>(AbstractDataView.java:74)

deyaeddin added a commit to deyaeddin/GridHelpers that referenced this issue Jan 8, 2024
@javier-godoy
Copy link
Member

As mentioned in #110 (comment), the current implementation iof this feature is intentionally restricted to in-memory data providers, because there is no efficient way to compute indexOf from a backend data provider. https://github.com/vaadin-component-factory/selection-grid-flow follows a different approach by capturing the indexes in the client-side, so that the data provider can resolve them.

@javier-godoy javier-godoy added the enhancement New feature or request label Jan 15, 2024
@mlopezFC
Copy link
Member

I have the following use case. I can host in memory all of the items, so I can use my grid without lazy loading, but the performance is slow, because every time that I enter in the grid I have to load all the items in memory. In certain cases (very few, rare I would say) I would need to select all the items to do a bulk operation (and my idea is to use enhanced selection for that), and in that time I don't mind in waiting to load all the items in memory. So if I understand well, is this feature only going to fetch all the items when I select a "big range" of the grid and in the rest of the cases just let the lazy loading mechanism to work as always?

@javier-godoy
Copy link
Member

javier-godoy commented Jun 29, 2024

So if I understand well, is this feature only going to fetch all the items when I select a "big range" of the grid and in the rest of the cases just let the lazy loading mechanism to work as always?

If you are asking about the proposal in PR #110, it was rejected because selecting M items from a Grid with N items would be O(N), regardless of the size of that range, and selecting M items one at a time would be O(M*N), while an optimum solution would be O(M) in both cases. In comparison, selection-grid is O(M) and O(M^2) respectively.

Our limitation is that we designed the feature assuming that retrieving the index of an item is a cheap operation, which holds true for in-memory datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: To Do
Development

No branches or pull requests

3 participants