-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Allow to pass all the data at a time (as an alternative to Datasource.get) #90
Comments
@philly-vanilly Thanks for the issue! Looking through Material CDK Virtual scrolling documentation, I would say that current ngx-ui-scroll approach correlates with "Virtual scroll with a custom data source" ("Specifying data") Material approach. They also suggest to implement MyDataSource and provide paging data flow manually (example). I'm not going to explain why manual datasource approach is important or could be useful, but I would agree that it is a good idea to have an additional API allowing to pass all the data array at a time. Also, I believe Redux isn't involved here. So I'm going to change the issue title and add "enhancement" label. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed within seven days if no further activity occurs. If it needs to remain open, add the "permanent" label. |
Hi @dhilt , Thanks for keeping up one of most well documented and maintained repos btw. Very appreciated |
@HadiAyoub I'm keeping this issue in mind, though there are not so many requests on it. Right now all my time is being spent on vscroll finalization, it will be an external framework-free core for ngx-ui-scroll, and this enhancement will go there after v1 is released. While there is no this feature implemented, you may use the following approach: datasource = new Datasource({
get: (start, count, success) => {
const end = Math.min(start + count - 1, this.data.length - 1);
success(start <= end ? this.data.slice(start, end + 1) : []);
}
}) Here |
If I understand correctly, there is no way to pass a whole array of items (handled in the redux store or some other external model) to the adapter/datasource-get and make it accept all of them. Instead you have to manually synchronize all the changes that happen at network-layer with subscibe/update methods. For enterprise applications that have layered architecture with separation of business and UI, this means a lot of boilerplate code that can and will result in bugs.
It would be nice if you could just pass an array or observable of an array to the ngx-ui-scroll directive (same way as angular material CDK or Ionic) and make it handle the rest.
The text was updated successfully, but these errors were encountered: