Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Feature Request Add Angular DataSource support to RxVirtualFor #1765

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

Open
friendlyAce opened this issue Aug 31, 2024 · 0 comments
Open

Feature Request Add Angular DataSource support to RxVirtualFor #1765

friendlyAce opened this issue Aug 31, 2024 · 0 comments

Comments

@friendlyAce
Copy link
Contributor

Problem Solved By The Feature

The current rx-virtual-for directive lacks support for the DataSource interface, which is available in Angular CDK's CdkVirtualForOf (https://material.angular.io/cdk/scrolling/overview#specifying-data).
This limitation restricts users who want to leverage existing DataSource implementations or need more complex data handling scenarios in virtual scrolling, without introducing further boilerplate code.

We are currently migrating to rx-angular to improve the responsiveness of our tool. Having native support for taking in a DataSource would help us reducing necessary boilerplate when using it in combination with the rx virtual for directive.

Solution

Implement support for the DataSource interface in rx-virtual-for, aligning with Angular CDK's implementation while maintaining rx-angular's reactive approach and perks.

The solution includes:

  • Adding DataSource as a valid input type for rxVirtualForOf directive
  • Implementing logic for connecting to and disconnecting from the DataSource with the lifecycle of the virtual for
  • Pass the ListRange changes directly to the connect method of the DataSource so taht the appropriate data from the DataSource can be fetched/handled and be returned to the virtual for directive
  • Provide a seamless integration for users to utilize their existing DataSource implementations

I created a small PR proposal here #1764

Alternatives Considered

As the rx virtual for directive already exposes the viewRange: ListRange hook, it is possible to implement the angular cdk CollectionViewer interface on the component that uses the rx virtual for directive and then connect the viewRange: Subject exposed from the rx virtual for to the viewChange: Observable, handle connect/disconnect to and from the data source manually with the lifecycle of the component.
And even tho it is possible and we are currently using it, as rx-virtual-for is a good alternative to the cdk virtual scrolling, this might be a missed opportunity to align with the existing Angular patterns and limits compatibility.

Additional Context

This addition acknowledges that while the feature isn't critical, it would be beneficial based on real-world use cases and would enhance the overall functionality of rx-virtual-for.

BR,
Vincent

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant