Closed yroc92 closed 4 years ago
Hi! Thanks for proposal. I think, I found better way to check it. Please, look at my last commit - if You think it's ok, please, let me know
It actually did not work for me. Are you able to pass in a new instance of TableVirtualScrollDataSource
to the table's dataSource
any time after init and it still renders?
Yes. I even add a test for this case. Can you check it again? If it's not working, can you provide example to reproduce?
Hi @yroc92 ! Did you try the last version?
Often there is a use case for when the
dataSource
input parameter is not a static value. Currently, if we pass a new object todataSource
after initialization of the view, then thetvsItemSize
directive fails to display any table rows because it was connected to the previous instance (seengAfterViewInit
method inTableItemSizeDirective
). Any new instances ofdataSource
will not be connected to since we do not observe changes.Proposal: use
MutationObserver
web api as seen here: https://nitayneeman.com/posts/listening-to-dom-changes-using-mutationobserver-in-angular/The
tvsItemSize
directive should do something like the following: