Posted 10 August 2022, 3:22 am EST
I’m trying to create a infinite scroll with server pagination and im want to know if there’s a way to implement this with JSON response because all the examples that i can find in the documentations is with oData.
What i have is an endpoint that returns the total of the items and 100 results per page, i want to use a infinite scroll to show them when they reach the bottom of the current results.
following one of the examples for the infinite scroll is just to add more data to the curren itemSource the issue is that if i do that the performance it’s pretty bad i took too long to concat the results when the table grows.
im using Angular 12 with this project and a shared table component so im not able to do too much manipulations in the HTML without loosing more performance.
so to concat the information im doing this
ngOnChanges(changes: SimpleChanges) {
if (changes && changes.data && changes.data.currentValue) {
this.itemSource.push(...changes.data.currentValue);
this.refreshTable();
}
}
private refreshTable(): CellType.Cell | null {
if (!this.flex.collectionView) return null;
const view = this.flex.collectionView;
const index = view?.currentPosition || 0;
console.log(index);
view.refresh();
view.currentPosition = index;
return view.currentItem;
}
let me know if you need more information.
Thanks