Using the cdkScrollable I'm encountering either a bug or a problem of my understanding:
I've implemented a DataSource
and I'm subscribing to the collectionViewer's viewChange
event in the connect
-Method. Just as it is done in this example.
Now in my code, the viewChange
event is never fired - so the dataSource is never loaded. I need the viewChange event because only this will tell me, which range
(or Page) of data I should load.
After a bit of research on github I found, that in _updateRenderedRange
(code) it checks for the length of the array that my datasource returns (which hasn't returned anything yet as I'm waiting for the event to fire).
The reason why the example works is, that it initializes an array with the length of 100000. I don't understand this connection between the dataLength
and the scrolling strategy. In my view, the size of the resulting data array should make no difference in calculating the range... I would think the range is calculated by the size of the scrollable element and the size of the items that are rendered. And maybe a parameter that tells the viewport, how many items there would be in total so it can draw the correct scrollbar (like a pager in a datatable that knows how many pages there are). But for that you don't need to initialize an array with that many items.
What am I missing here?