-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Add virtual scrolling support to tables #32487
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
base: main
Are you sure you want to change the base?
Conversation
Revives the changes from angular#21708 and brings the up to date with the current repo. Note that this is the initial step, we still need some fixes an cleanups. Co-Authored-By: Michael-James Parsons <MichaelJamesParsons@users.noreply.github.com>
Fixes an issue where the table virtual scroller was jumping back to the top whenever it needs to re-render.
The table virtual scroller had a proxy class to work around a circular DI error. These changes rework the usage site so the workaround isn't required anymore.
We can put the factory in-line, instead of having to export it.
Combines the logic from the `CdkTableVirtualScroll` with the existing `CdkTable`. This allows us to remove the following steps from the virtual scrolling setup: 1. Having to import `CdkTableVirtualScroll`. 2. Having to set `fixedLayout` on the table. 3. Having to set `virtualScroll` on the table.
Exposes the `renderedContentOffset` stream on the virtual scroll viewport since it can be useful for users outside of the CDK table.
Implements the `measureRangeSize` method so the CDK table is compatible with auto-sizing.
Adds examples of virtual scrolling to the CDK and Material tables.
Sets up some tests for the virtual scrolling logic.
e426476 to
3140223
Compare
| @@ -0,0 +1,37 @@ | |||
| <p>Showing {{dataSource.length}} rows</p> | |||
|
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that there's a slight jump in this example when the column width changes. It's because the fixedLayout option is broken on the Material table. I'll send a separate PR since it may require some client fixes.
|
Deployed dev-app for 3140223 to: https://ng-dev-previews-comp--pr-angular-components-32487-dev-ocum18z8.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
|
Deployed docs-preview for 3140223 to: https://ng-dev-previews-comp--pr-angular-components-32487-docs-9to7g8zs.web.app Note: As new commits are pushed to this pull request, this link is updated after the preview is rebuilt. |
Updates the CDK and Material tables to add support for virtual scrolling. This is based on the initial work in #21708 that I've productionized, made more ergonomic, fixed a few bugs, added tests and documentation.
To enable virtual scrolling for the table, you need to do two things.
<cdk-virtual-scroll-viewport/>around it:Related to #10122.