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
feat(module:table): handle CDK DataSource for virtual scroll #3766
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3766 +/- ##
=========================================
Coverage ? 95.15%
=========================================
Files ? 730
Lines ? 14744
Branches ? 1921
=========================================
Hits ? 14030
Misses ? 267
Partials ? 447
Continue to review full report at Codecov.
|
7928f05
to
02da46a
Compare
As of now builds fail because in other sources you're accessing the table
This won't work because |
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.
I added some comments, thanks for your PR!
844c211
to
c68c4f0
Compare
@vthinkxie Could you give a look at the Also now you can check the result in the preview! 😎 I'm happy Edit: this problem can be solved by incrementing I've also noticed an issue, which was already there, when using virtual scroll with front-end pagination. |
Deploy preview for ng-zorro-master ready! Built with commit 7b5b12f |
Deploy preview for ng-zorro-master ready! Built with commit 8a4d9f8 |
703ef69
to
a2d09d7
Compare
A quick update. |
0320865
to
b4ab3bf
Compare
6500a6c
to
246a678
Compare
Thanks! @vthinkxie @wendzhue @hsuanxyz
Which means
This is particularly tricky. The ideal workflow would be:
However what actually happens is
You can clearly see there is a problem, the table is "behind" of an HTTP call, and the data displayed is wrong. Possible solutions:
This plays awesome with this piece of code
Two change detection cycles are run then.
Here the major issue is backward campatibility. While I like the code I've written, I think it still has limitations. The thing is getting data using this technique
while pretty neat, require accessing the internal Sorry for the long message, but I prefer having a clear overview of what doesn't work as expected |
ba541b0
to
cfdd93c
Compare
if (this.nzFrontPagination) { | ||
this.nzTotal = data.length; | ||
this.nzTotal = this.data.length; |
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.
This is not ideal, as the NzDataSource
instance might not have the value available at this point. I need to refactor this, somehow, into an "asynchronous" process
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.
agree, let's do this :)
Hi @lppedd When the nzFrontPagination is true, there should no http calls I think, because all data are loaded at the very beginning, and the pagination split the data into pieces, and display them in the |
@vthinkxie but how do you enforce the user to provide a The same applies with the But maybe I misunderstood what you're trying to say. |
@lppedd |
@lppedd well the user isn't forced to do HTTP calls, but it still is an option. We don't have control over the implementation of the inputted |
@lppedd |
@vthinkxie yes absolutely. Just a question: as I had written in the long message above, why not deprecating the use of the internal field Anyway, I'll review the code again, and report back if I find something else worth discussing (I don't think so). Then I'll write some tests. |
@lppedd |
@vthinkxie sure, agree. I'll keep you updated also on #3766 (comment), which needs some more thinking. If you want to throw ideas of any kind, they're very welcome. |
@vthinkxie Sorry I've been pretty busy with other work. Just wanted to let you know I haven't forgotten. |
Hi @lppedd |
Hi |
Opening this PR for discussion only at the moment.
This is the minimal implementation to support the use of a
DataSource
.I need this functionality for a product I'm developing and this would be sufficient at the moment.
I'm especially worried about the problem described in this comment.
What is missing
Example:
Warning when using incompatible inputs (e.g.DataSource
and non-virtual scroll)As a next step, I'd like to leverage the
DataSource
itself, to produce a uniform implementation.This means if a user passes in
[nzData]="[...]"
, I'll wrap it around anArrayDataSource
.This would mean an overall cleaner implementation, maybe delegating some functionalities to a common, base
DataSource
.Closes #3571
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Does this PR introduce a breaking change?