Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. public with sharing class AccountListCtrl {
  2.  
  3. @AuraEnabled(cacheable=true)
  4. public static List<Api.AccountWrapper> getAccounts(String filter) {
  5. List<Api.AccountWrapper> result = new List<Api.AccountWrapper>();
  6.  
  7. try {
  8. result = ...
  9. }
  10. catch(Exception ex) {
  11. new AuraHandledException()...
  12. }
  13.  
  14. return result;
  15. }
  16.  
  17. import { LightningElement, track, api } from "lwc";
  18.  
  19. import getAccounts from "@salesforce/apex/AccountCtrl.getAccounts";
  20.  
  21. export default class TaskList extends LightningElement {
  22.  
  23. @track accounts = [];
  24.  
  25. connectedCallback() {
  26. this.loadAccounts("myAccounts");
  27. }
  28.  
  29. changeFilter(event) {
  30. this.loadAccounts(event.detail.value);
  31. }
  32.  
  33. loadAccounts(filter) {
  34. getProcesses({ filter: filter })
  35. .then((result) => {
  36. this.accounts = result;
  37. })
  38. .catch((error) => {
  39. ...
  40. })
  41. .finally(() => {
  42. ...
  43. });
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement