Skip to content

Instantly share code, notes, and snippets.

@veeranjik
Last active October 15, 2019 06:55
Show Gist options
  • Save veeranjik/4dd8b72d4a5e2b95dba4407ac63bc1e1 to your computer and use it in GitHub Desktop.
Save veeranjik/4dd8b72d4a5e2b95dba4407ac63bc1e1 to your computer and use it in GitHub Desktop.
/**
* @category Lightning Web component Controller
* @author Veeranjaneyulu k
* @date 11-Oct-2019
**/
import {LightningElement, track, wire, api} from 'lwc';
import loadOpp from '@salesforce/apex/OpportunityController.getFunds';
import {CurrentPageReference} from 'lightning/navigation';
const PAGE_SIZE = 10;
const columns = [
{label: 'Label',fieldName: 'Name'},
{label: 'Account Name',fieldName: 'Account.Name',type: 'url'},
{label: 'CloseDate',fieldName: 'CloseDate',type: 'date'},
{label: 'Amount',fieldName: 'Amount',type: 'currency'},
{label: 'Type',fieldName: 'Type',type: 'text'},
{label: 'ExpectedRevenue',fieldName: 'ExpectedRevenue',type: 'text'},
];
export default class ParentPagination extends LightningElement {
@track error;
@track page = 1;
@api offset = 0;
@wire(loadOpp, {
pageSize: PAGE_SIZE,
pageNumber: '$page',
myOffSet: '$offset'
}) wiredOpport;
handlePageNext() {
this.offset = this.offset + 5;
}
handlePagePrevious() {
if (this.offset > 0) {
this.offset = this.offset - 5;
} else {
this.offset = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment