Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public with sharing class AccountListCtrl {
- @AuraEnabled(cacheable=true)
- public static List<Api.AccountWrapper> getAccounts(String filter) {
- List<Api.AccountWrapper> result = new List<Api.AccountWrapper>();
- try {
- result = ...
- }
- catch(Exception ex) {
- new AuraHandledException()...
- }
- return result;
- }
- import { LightningElement, track, api } from "lwc";
- import getAccounts from "@salesforce/apex/AccountCtrl.getAccounts";
- export default class TaskList extends LightningElement {
- @track accounts = [];
- connectedCallback() {
- this.loadAccounts("myAccounts");
- }
- changeFilter(event) {
- this.loadAccounts(event.detail.value);
- }
- loadAccounts(filter) {
- getProcesses({ filter: filter })
- .then((result) => {
- this.accounts = result;
- })
- .catch((error) => {
- ...
- })
- .finally(() => {
- ...
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement