Activity Forums Salesforce® Discussions What is lightning event in Salesforce?

  • Hariom Chaudhary

    Member
    August 27, 2019 at 5:09 am

    Hi, Deepak

    Lightning events are those which are fired from JavaScript controller actions that are triggered when  a user interacts with the user interface.

  • Saddam

    Member
    August 27, 2019 at 6:13 am

    Hi Deepak,

    here are two types of events: Application Events and Component Events.

    Application events should be used sparingly because they go to all components and (even if only a few components actually handle the event) that can slow things down. An example where I have used them is in a customer community where each page was to be viewed in the context of a particular Account. I put an Account switcher component in the header part of the page, then fired an Application event when the Account changed. This allowed all components on the page to change context and show information specific to that Account.

    Component events are for a child component to communicate with its parent (that is, the child is contained inside the parent). An example of this is found in the standard components themselves e.g. ui:menuList fires a ui:menuSelect event when the menu is clicked. If you put a ui:menuList in your custom component, you can handle that event coming up from the child, and take some appropriate action.

    The other inter-component communication mechanism is via attributes. A parent can communicate with its children by changing the values of their attributes.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos