Skip to content

Instantly share code, notes, and snippets.

@arun12209
Created Jun 12, 2022
Embed
What would you like to do?
import { LightningElement } from 'lwc';
//import the helper javascript module/file
import fetchDataHelper from './fetchDataHelper';
const columns = [
{ label: 'Label', fieldName: 'name' },
{ label: 'Website', fieldName: 'website', type: 'url' },
{ label: 'Phone', fieldName: 'phone', type: 'phone' },
{ label: 'Balance', fieldName: 'amount', type: 'currency' },
{ label: 'CloseAt', fieldName: 'closeAt', type: 'date' },
];
export default class LightningTable extends LightningElement {
data = [];
columns = columns;
// async-await method
async connectedCallback() {
const data = await fetchDataHelper({ amountOfRecords: 100 });
this.data = data;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment