Skip to content

Instantly share code, notes, and snippets.

@renzo01
Created August 19, 2021 16:46
Show Gist options
  • Save renzo01/f76cb1bdcd7825f55505851301df8e91 to your computer and use it in GitHub Desktop.
Save renzo01/f76cb1bdcd7825f55505851301df8e91 to your computer and use it in GitHub Desktop.
How to make a infinite Scroll in Datatable
/**Required Variables */
// @track data = [];
// @track previousOffset = -1;
// @track offset = 0;
// @track limitOfRows = 5;
// totalContractsLineItems = 0;
/**Getter funtions */
// getData(){
// //calculate number of rows
// this.limitOfRows = this.height/50;
// getCurrentContractLineItem({contractId:[Id],limitRecords:this.limitOfRows, offsetRecords:this.offset })
// .then(result => {
// this.showSpinner = true;
// let tempData = this.parseData(result);
// this.data = [...this.data, ...tempData];
// this.offset += this.limitOfRows;
// this.showSpinner = false;
// }).catch(error => console.log(error))
// }
// getNumberOfTotalContractsLineItems(){
// numberOfTotalRecords({contractId:[Id]})
// .then(result => this.totalContractsLineItems = result).catch(error => console.log(error));
// }
/**Function Handler */
// loadMoreHandler(e){
// e.target.isLoading = true;
// if(this.data?.length >= this.totalContractsLineItems){
// e.target.enableInfiniteLoading = false;
// }else if(this.previousOffset !== this.offset){
// this.getData();
// this.previousOffset = this.offset;
// }
// e.target.isLoading = false;
// }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment