Display List of Accounts with delete button on Lightning Component

Hi Guys,
Today Iam here to explain how to display list of accounts with delete button on Lightning component.

Business case : User need to show list of accounts and with delete button on display their page
Solution : we helped by designing lightning component


Step1 : Create a controller class
Path setup- UserMenu – Developer Console -File-New Apex Class

AccountsController


public class AccController {
    @AuraEnabled
    public static List getAccounts() {
    return [SELECT Id, name, industry, Type, NumberOfEmployees, TickerSymbol, Phone 
            FROM Account ORDER BY createdDate ASC];
    }
   }                               

                        

Step2 : Create a lightning Component
Path setup- UserMenu – Developer Console -File-New Lightning Component

Account List Component

Step3 : Create Controller for lightning Component
Path : Click on controller left side of our lightning component or with shortcut ctrl+shift+2

Account List controller

Step4 : Create helper for lightning Component
Path : Click on helper left side of our lightning component or with shortcut ctrl+shift+3

Account List helper js

Step5 : Create lightning Component application
Path : setup- UserMenu – Developer Console -File-New Lightning Application

Account List application


Hola !! , we have seen list of accounts with delete button



Download: SalesforceQA


Please comments us for more updates and share to other to help.
Keep Visiting us for more updates
Like us for more updates
Fb Page : ForceLearn
keep share to help others  😎 😎 😎