Skip to content

Instantly share code, notes, and snippets.

@sakthivelsfdc
Created July 10, 2019 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sakthivelsfdc/40768b43fa716179dba869d235a15ca3 to your computer and use it in GitHub Desktop.
Save sakthivelsfdc/40768b43fa716179dba869d235a15ca3 to your computer and use it in GitHub Desktop.
import { LightningElement, track } from 'lwc';
import searchAccounts from '@salesforce/apex/AccountController.searchAccount';
const columnList = [
{label: 'Id', fieldName: 'Id'},
{label: 'Name', fieldName: 'Name'},
{label: 'Website', fieldName: 'Website'},
{label: 'Industry', fieldName: 'Industry'}
];
export default class LightningDataTable extends LightningElement {
@track accountList;
@track columnList = columnList;
@track noRecordsFound = true;
findAccountResult(event) {
const accName = event.target.value;
if(accName) {
searchAccounts ( {accName})
.then(result => {
this.accountList = result;
this.noRecordsFound = false;
})
} else {
this.accountList = undefined;
this.noRecordsFound = true;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment